An Easy Task
An Easy Task
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 1 Accepted Submission(s) : 1
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem 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
single integer T which is the number of test cases. T test cases
follow.
Each test case contains two positive integers Y and N(1<=N<=10000).
Output
Sample Input
3
2005 25
1855 12
2004 10000
Sample Output
2108
1904
43236
Hint
We call year Y a leap year only if (Y%4==0 && Y%100!=0) or Y%400==0.
int main(){
int T,n,y;
int i,count;
while(scanf("%d",&T)!=EOF){
while(T--){
count=0;
scanf("%d%d",&y,&n);
for(i=y;count<n;i++)/* 闰年不是隔四年一循环*/
if((i%4==0&&i%100!=0)||(i%400==0))
count++;/*是闰年就++,等到到了第nth时候就停止,i-1就是要求的年份*/
printf("%d\n",i-1);
}
}
}
An Easy Task的更多相关文章
- CodeForces462 A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- HDU-------An Easy Task
An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- ZOJ 2969 Easy Task
E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...
- An Easy Task(简箪题)
B. An Easy Task Time Limit: 1000ms Case Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO f ...
- HDU-1076-An Easy Task(Debian下水题測试.....)
An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- Codeforces 263A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #263 (Div. 2) A. Appleman and Easy Task【地图型搜索/判断一个点四周‘o’的个数的奇偶】
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- HD1046An Easy Task
Problem Description Ignatius was born in a leap year, so he want to know when he could hold his birt ...
- HDOJ 1076 An Easy Task(闰年计算)
Problem Description Ignatius was born in a leap year, so he want to know when he could hold his birt ...
随机推荐
- 401 Palindromes(回文词)
Palindromes A regular palindrome is a string of numbers or letters that is the same forward as ba ...
- swift开发:试玩 Apple 站点的 playground
https://developer.apple.com/library/prerelease/ios/documentation/swift/conceptual/swift_programming_ ...
- Centos 6.5使用Bumblebee关闭N卡,冷却你的电脑
夏天来了,笔记本装的Centos一直非常热.随着天气的变化,这个问题真的要攻克了.差了下原因可能是双显卡笔记本,N卡驱动不完好,导致风扇狂叫. 昨天安装了nvidia 的显卡驱动本以为时间安静了.但是 ...
- EasyBCD 2.2中文版安装变色龙wowpc.iso详细教程(适用各个版本)
第一章 安装变色龙引导本章节提供3种安装方案,请自行选择 1.使用 Windows 版变色龙安装器安装适用引导方案:BIOS+MBR第1步:下载 Chameleon Install 2.2svn228 ...
- MyEclipse安装插件的几种方法 转
http://www.cnblogs.com/pharen/archive/2012/02/08/2343342.html MyEclipse安装插件的几种方法 本文讲解MyEclipse(MyEcl ...
- mysql 优化工具
explain profiling 建议提供以下信息 show table status like 'audit';show create table audit;show index from a ...
- A Simple Problem with Integers(线段树入门题)
Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. On ...
- obj 转为Json 时间格式自定义
var tb = evnWarningBll.GatWarning(); var timeFormat = new IsoDateTimeConverter(); ...
- LeetCode 326
Power of Three Given an integer, write a function to determine if it is a power of three. Follow up: ...
- [未完成]关于POI的使用
关于POI的使用关于POI的使用关于POI的使用关于POI的使用