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 ...
随机推荐
- Shell脚本中单引号(‘)和双引号(“)的使用区别[转载]
shell可以识别4种不同类型的引字符号: 单引号字符' 双引号字符" 反斜杠字符\ 反引号字符` 1. 单引号 ( '' ) # grep Susan phonebook Susan Go ...
- SMA2SATA、PCIe2SATA转换模块(也有叫:Sata Test Fixtures)
SMA2SATA.PCIe2SATA测试夹具(Sata Test Fixtures) 去年制作SMA2SATA.PCIe2SATA适配器的过程早就想写出来,但一直没有时间,今天星期六有个空儿,简单整理 ...
- 对面向对象程序设计(OOP)的认识
前言 本文主要介绍面向对象(OO)程序设计,以维基百科的解释: 面向对象程序设计(英语:Object-oriented programming,缩写:OOP),指一种程序设计范型,同时也是一种程序开发 ...
- Lua 字符串函数小结
1.求字符串长度 string.len(str) 2.大小写转换 string.upper(str) string.lower(str) 3.字符串查找(非全局) --func_string.lua ...
- python安装包问题小结
你可能遇到的问题包括:ImportError: No module named sklearn 未安装sklearn包ImportError: DLL load failed: 找不到指定的模块Imp ...
- IIS 7.0 的 ASP.NET 应用程序生命周期概述(转载)
IIS 7.0 的 ASP.NET 应用程序生命周期概述更新:2007 年 11 月本主题介绍在 IIS 7.0 集成模式下运行以及与 IIS 7.0 或更高版本一起运行的 ASP.NET 应用程序的 ...
- VC6-Win7下VC++6.0打开多个工程的设置
在Win7操作系统下,如果是以Administrator登陆,则VC6.0打开工程文件的时候,不能同时打开多个工程文件,后打开的工程会将前一个工程close掉,这样,VC6.0只能出现一个进程.在xp ...
- CoFun 1612 单词分组(容斥)
Description Stan有N个不同的单词,这天,Stan新结交的两个朋友来他这里玩,Stan作为主人,他需要送给他们单词,但由于Stan不能偏心,所以Stan给每个单词一个权值v_i,他需要他 ...
- VC运行库版本不同导致链接.LIB静态库时发生重复定义问题的一个案例分析和总结
转帖:http://blog.csdn.net/whygosofar/article/details/2821875 MSDN中对于在不同的配置下Link的LIB作了说明: C Runtime Lib ...
- spftlayer 安装及简单使用
1,yum -y install python-pip; pip(Python packet index);