CDZSC_2015寒假新人(1)——基础 h
Description
Given a positive integers Y which indicate the start year, and a positive integer N, your task is to tell the Nth leap year from year Y.
Note: if year Y is a leap year, then the 1st leap year is year Y.
Input
Each test case contains two positive integers Y and N(1<=N<=10000).
Output
Sample Input
2005 25
1855 12
2004 10000
Sample Output
1904
43236
Hint
We call year Y a leap year only if (Y%4==0 && Y%100!=0) or Y%400==0.
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
int N,n,m;
scanf("%d",&N);
while(N--)
{
scanf("%d%d",&n,&m);
if((n%==&&n%==)||(n%!=&&n%==))
{
m--;
}
else
{
while(n--)
{
if((n%==&&n%==)||(n%!=&&n%==))
break;
}
}
for(int i=n/+;i<=(n+*m)/;i++)
{
if(i%!=)
{
m++;
}
}
printf("%d\n",n+*m);
}
}
CDZSC_2015寒假新人(1)——基础 h的更多相关文章
- CDZSC_2015寒假新人(2)——数学 H
H - H Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(1)——基础 e
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...
- CDZSC_2015寒假新人(1)——基础 i
Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...
- CDZSC_2015寒假新人(1)——基础 g
Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...
- CDZSC_2015寒假新人(1)——基础 f
Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...
- CDZSC_2015寒假新人(1)——基础 d
Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...
- CDZSC_2015寒假新人(1)——基础 c
Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...
- CDZSC_2015寒假新人(1)——基础 b
Description The highest building in our city has only one elevator. A request list is made up with N ...
- CDZSC_2015寒假新人(1)——基础 a
Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...
随机推荐
- 犯罪团伙 codevs 3554
这是一道经典的水题,提供两种方法:①深搜 ②并查集 NO.1 深度优先搜索: #include<iostream>#include<cstdio>#include<al ...
- ESP8266固件烧录方法
今天拿到ESP8266的板子,第一步是进行烧录固件. 首先是使用官方自带的参考文档,进行操作.发现每次烧录均卡在等待同步上电. 之后发现是烧录方法错误. 正确的烧录方法: 先按下FLASH不放,再按烧 ...
- Java中list<Object>集合去重实例
一:Java中list去重的方法很多,下面说一下其中一种方法:把list里的对象遍历一遍,用list.contain(),如果不存在就放入到另外一个list集合中: 二:实例 这里需要注意的是:使用c ...
- JSP和Servlet的区别。
1.jsp经编译后就变成了Servlet.(JSP的本质就是Servlet,JVM只能识别java的类,不能识别JSP的代码,Web容器将JSP的代码编译成JVM能够识别的java类)2.jsp更擅长 ...
- 用css实现一个空心圆,并始终放置在浏览器窗口左下角
用css实现一个空心圆,并始终放置在浏览器窗口左下角 div{ position:fixed; bottom:0; ...
- 简单说pyglet.event
emitter,就是pyglet.event.EventDispatcher的子类, 负责发出事件的消息,并且规定了响应消息的函数名. class Consumer(pyglet.event.Even ...
- 畅通工程再续--hdu1875
畅通工程再续 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Subm ...
- [C入门 - 游戏编程系列] 贪吃蛇篇(六) - 蛇实现
这一篇是关于设置蛇的属性的,接上一篇(五). 设置蛇的速度,很简单,只要不是负数就行了. void SNK_SetSnakeSpeed(Snake *snake, int speed) { ) sna ...
- 1172: 单词接龙(XCOJ 暴力DFS)
1172: 单词接龙 时间限制: 1 Sec 内存限制: 128 MB提交: 12 解决: 5 标签提交统计讨论版 题目描述 单词接龙是一个与我们经常玩的成语接龙相类似的游戏,现在我们已知一组单词 ...
- SQLServer中数据库文件的存放方式,文件和文件组
我们公司近一年来做了一个CRM系统. 遇到一个问题就是:在插入交流记录的时候速度特别慢.(交流记录数据量大) 后来我们经理采用文件组的方法,将客户交流记录这张表提出来就快很多了 这里有一篇关于文件组的 ...