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 ...
随机推荐
- C/C++中的空类及抽象类大小
代码: #include <iostream> using namespace std; struct A{ }; struct B{ int i; }; class C:B{ ; }; ...
- 费马小定理&欧拉定理
在p是素数的情况下,对任意整数x都有xp≡x(mod p).这个定理被称作费马小定理其中如果x无法被p整除,我们有xp-1≡1(mod p).利用这条性质,在p是素数的情况下,就很容易求出一个数的逆元 ...
- GetClientRect()和GetWindowRect()
GetClientRect() 是得到客户区坐标系下客户区的RECT GetWindowRect()是得到屏幕坐标系下整个窗口的RECT GetSystemMetrics()是获得屏幕分辨率大小 ...
- 【JAVA编码专题】 JAVA字符编码系列三:Java应用中的编码问题
这两天抽时间又总结/整理了一下各种编码的实际编码方式,和在Java应用中的使用情况,在这里记录下来以便日后参考. 为了构成一个完整的对文字编码的认识和深入把握,以便处理在Java开发过程中遇到的各种问 ...
- CentOS和Ubuntu的区别
CentOS(Community ENTerprise Operating System)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代 ...
- ViewDragHelper的使用
一.ViewDragHelper的原理 是一个能够自用移动ViewGroup内部View的控件. 通过获取ViewGroup的点击事件,之后通过Scroller滑动来进行对ViewGroup内部控件的 ...
- 如何让你的 footer 总是在浏览器底部无论什么分辨率无论什么浏览器?
一个可以用的CSS驱动的可粘在底部的Footer 我们曾经都或多或少的试过用CSS来把Footer固定在底部的经理,但是他们总是不能正常的粘在底部,不是吗?可喜的是,痛苦的研究如何让footer粘在底 ...
- eclipse安装github插件egit
http://jingyan.baidu.com/article/4853e1e529483c1909f726c3.html help->InstallNew Software,这是安装插件推荐 ...
- openssl对数组加密解密的完整实现代码
本例是用C实现的对一个数组进行加密,加密到第二个数组,然后解密到另一个数组的完整实现代码. #include <stdio.h> #include <string.h> #in ...
- Network Attack
Network Attack Nicola regularly inspects the local networks for security issues. He uses a smart and ...