HD1046An Easy Task
Problem Description
Ignatius was born in a leap year, so he want to know when he could hold his birthday party. Can you tell him?
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
The input contains several test cases. The first line of the input is a 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
For each test case, you should output the Nth leap year from year Y.
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.)
水题,注意开始年如果也是瑞年的话,也要算一个:
#include<iostream>
using namespace std;
int main(){
int n,a,b,count;
cin>>n;
while(n--){
count=0;
cin>>a>>b;
while(count!=b)
{
a=a+0;
if((a%4==0 && a%100!=0)||a%400==0)
{count ++;}
a++;
}
cout<<a-1<<endl;
}
return 0;
}
HD1046An 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 ...
- An Easy Task
An Easy Task Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- 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 ...
- 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 ...
随机推荐
- JS Scoping and Hoisting
参考了这篇文章 http://www.jb51.net/article/30719.htm var v='Hello World'; (function(){ console.log(v); })() ...
- 【Todo】所有Locked的题目的分析解答
下面这个链接有比较全的leetcode题目包括锁的 http://www.cnblogs.com/grandyang/p/4606334.html https://leetcode.com/probl ...
- Quickhit快速击键
一.项目分析 根据输入速率和正确率将玩家分为不同等级,级别越高,一次显示的字符数越多,玩家正确输入一次的得分也越高.如果玩家在规定时间内完成规定次数的输入,正确率达到规定要求,则玩家升级.玩家最高级别 ...
- Mvc 自带分页控件PagedList.Mvc Demo示例
添加/下载PagedList.Mvc 直接搜索mvc pagelist 就会出来.安装完成即可.在项目的packages文件夹下面就会出现PagedList.Mvc.4.5.0.0 和PagedLis ...
- highCharts入门-强大的图表库插件
简介 Highcharts 是一个用纯JavaScript编写的一个图表库, 能够很简单便捷的在web网站或是web应用程序添加有交互性的图表,并且免费提供给个人学习.个人网站和非商业 ...
- php扩展编译(以memcached为例)
1)到 https://pecl.php.net/ 上搜索并下载(wget)你需要的扩展的源码包 2)解压并切换进入扩展包的目录 3)使用phpize工具自动生成 configure 4)config ...
- qt多文档
http://blog.csdn.net/siren0203/article/details/5661541
- MYSQL BENCHMARK函数的使用
MYSQL BENCHMARK函数是最重要的函数之一,下文对该函数的使用进行了详尽的分析,如果您对此感兴趣的话,不妨一看. 下文为您介绍的是MYSQL BENCHMARK函数的语法,及一些MYSQL ...
- 【PHP入门到精通】:Ch05:字符串处理
Ch05: 字符串简介 5.1 字串说明 字符串是指由>=0个字符构成的一串字符,所以叫字符串.这里所说的字符主要包括以下几种类型:数字类型:如1, 2, 3, 4等.字母类型:如果a, b, ...
- Oracle查看和修改其最大的游标数
原文 Oracle查看和修改其最大的游标数 以下的文章主要是介绍Oracle查看和修改其最大的游标数,本文主要是通过相关代码的方式来引出Oracle查看和修改其最大的游标数的实际操作步骤,以下就是文章 ...