2015 AlBaath Collegiate Programming Contest(2月14日训练赛)
A (By ggg):
题意:一个人还有x秒到红绿灯,这个红绿灯有g秒绿灯,y秒黄
灯,r秒红灯,问你到红绿灯的时候是什么灯。值得注意的是绿
灯变黄灯时,第g秒是黄灯了。
B (By Anxdada):
Gym - 100947B
C(By Kresnt):
显然,当 n 时偶数的时候,只有 2 种取法(取下标为奇数的,或是取下标为偶数的) 当 n 为奇数时,按照隔一取一的方式遍历序列
Seq A:1 5 3 2 4
遍历为 Seq B:1 3 4 5 2 然后问题就变成了从 *B* 序列中取 *连续的* n/2+n&1 个数 开一个前缀和sum[] 就解决啦
D (By ggg) :
题意:给你一个n,要你输出三个数,相互给予后都能成为n,每次给予的数的大小是被给予的数的大小。数学思维题,直接贴代码感受
void solve() {
int n; scanf("%d", &n);
if (n%8!=0) puts("Impossible");
else {
printf("%d %d %d\n", n/8*11, n/8*7, n/8*6);
}
}
int main() {
int t = 1;
scanf("%d", &t);
while(t--)
solve();
return 0;
}
E(By):
F(By pipixia):
G(By Cyril1317):
Gym - 100947G Square Spiral Search
H(By Cyril1317):
Gym - 100947H Phobia
I(By xgg):
gym 100947I (求因子)
J(By):
K(By Kresnt):
这是一道模拟题
(0,0)
–> 右移
{
–> 向左下角移
–> 到边界,
1)左边界的话向下
2) 下边界的话向右
–> 向右上移
}
summarize 一下,发现 “{” “}”内的是重复的,故写成循环就好了
然后发现第一步右移到了右上角是有问题的,就改成
1)在上边界的话右移
2)在右边界的话下移
以
while(true){
ans.push_back(mp[x][y]);
if(y < n-1) y++;
else x++;
while(y > 0 && x < n-1)
ans.push_back(mp[x++][y--]);
ans.push_back(mp[x][y]);
if(x < n-1) x++;
else y++;
while(y < n-1 && x > 0)
ans.push_back(mp[x--][y++]);
if(x == n-1 && y == n-1) break;
}
2015 AlBaath Collegiate Programming Contest(2月14日训练赛)的更多相关文章
- 2015 AlBaath Collegiate Programming Contest B
Description Yaaaay, Haven't you heard the news? Bakaloria results are out! And Reem had very good gr ...
- 2015 AlBaath Collegiate Programming Contest A
Description Tamer is traveling with his brother on a long highway. He sees a traffic light at a dist ...
- The 2015 China Collegiate Programming Contest A. Secrete Master Plan hdu5540
Secrete Master Plan Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Othe ...
- The 2015 China Collegiate Programming Contest Game Rooms
Game Rooms Time Limit: 4000/4000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submi ...
- 2015 German Collegiate Programming Contest (GCPC 15) + POI 10-T3(12/13)
$$2015\ German\ Collegiate\ Programming\ Contest\ (GCPC 15) + POI 10-T3$$ \(A.\ Journey\ to\ Greece\ ...
- Gym 100952E&&2015 HIAST Collegiate Programming Contest E. Arrange Teams【DFS+剪枝】
E. Arrange Teams time limit per test:2 seconds memory limit per test:64 megabytes input:standard inp ...
- Gym 100952F&&2015 HIAST Collegiate Programming Contest F. Contestants Ranking【BFS+STL乱搞(map+vector)+优先队列】
F. Contestants Ranking time limit per test:1 second memory limit per test:24 megabytes input:standar ...
- Gym 100952A&&2015 HIAST Collegiate Programming Contest A. Who is the winner?【字符串,暴力】
A. Who is the winner? time limit per test:1 second memory limit per test:64 megabytes input:standard ...
- Codeforces Gym100952 A.Who is the winner? (2015 HIAST Collegiate Programming Contest)
A. Who is the winner? time limit per test 1 second memory limit per test 64 megabytes input stan ...
随机推荐
- SpringMVC实现ajax文件上传
SpringMVC实现文件上传,直接上代码: 后台代码: 01 @RequestMapping(value = "/uploadApk") 02 @ResponseBody 03 ...
- Codechef LOCAUG17
做完题目很少有写题解的习惯,强行PO一组吧. 比赛链接:https://www.codechef.com/LOCAUG17 PRINCESS 给定字符串s,问s是否存在长度大于1的回文子串. 解:分两 ...
- java web url编码解码问题(下载中文名文件)
问题描述:需要url直接访问中文名的文件,类似于在地址栏里直接输入http://localhost:8080/example/丽江旅游攻略.doc 来进行文件下载,tomcat的server.xml文 ...
- Spring源码分析——调试环境搭建(可能是最省事的构建方法)
1. 依赖工具 idea git jdk 1.8 + Gradle 2. 获取源码 从github https://github.com/spring-projects/spring-framewor ...
- 机器学习(2):简单线性回归 | 一元回归 | 损失计算 | MSE
前文再续书接上一回,机器学习的主要目的,是根据特征进行预测.预测到的信息,叫标签. 从特征映射出标签的诸多算法中,有一个简单的算法,叫简单线性回归.本文介绍简单线性回归的概念. (1)什么是简单线性回 ...
- python 类对象和实例对象动态添加方法
class Person(): def __init__(self, name): self.name = name def print_name(self): print(self.name) p ...
- boost 编译 asio 程序,简单socket 编程
自己第一次玩boost,对C++也非常不熟悉,记录一下自己的学习过程. 安装编译 boost 包解压到/opt下 tar -zxvf /media/C06EDE596EDE47B4/mnt/boost ...
- Oracle 正则化
摘抄自:http://www.cnblogs.com/scottckt/archive/2012/10/11/2719562.html ORACLE中的支持正则表达式的函数主要有下面四个: 1,REG ...
- LightOJ 1235 - Coin Change (IV) (折半枚举)
题目链接: http://www.lightoj.com/volume_showproblem.php?problem=1235 题目描述: 给出n个硬币,每种硬币最多使用两次,问能否组成K面值? 解 ...
- 题解报告:poj 2631 Roads in the North(最长链)
Description Building and maintaining roads among communities in the far North is an expensive busine ...