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的更多相关文章

  1. 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 ...

  2. An Easy Task

    An Easy Task Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total ...

  3. HDU-------An Easy Task

    An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...

  4. ZOJ 2969 Easy Task

    E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...

  5. An Easy Task(简箪题)

    B. An Easy Task Time Limit: 1000ms Case Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO f ...

  6. HDU-1076-An Easy Task(Debian下水题測试.....)

    An Easy Task Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tot ...

  7. Codeforces 263A. Appleman and Easy Task

    A. Appleman and Easy Task time limit per test  1 second memory limit per test  256 megabytes input  ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. D3D中深度测试和Alpha混合的关系

    我在学习D3D的深度测试和Alpha混合的时候,有一些遗憾.书上提供的例子里说一定要先渲染不透明物体,再渲染透明物体,对渲染状态的设置也有特殊要求.我看的很晕.自己查图形学的书,上网找资料,结果还是糊 ...

  2. UVa 10420 List of Conquests

    题意就是有N个pl妹子,然后每行第一个单词是妹子的国籍,后面是妹子的名字. 你的任务就是统计相同国籍妹子的个数,然后按字母表顺序输出. 我首先把所有的国籍都读入,然后用qsort()按字母表顺序排序. ...

  3. 集成框架jar包的一些选择

    我们往往在官网上下载了框架需要的jar却不知道该导入什么. required包里面的是必须导入的jar jar应该一切从简

  4. POJ 2983 Is the Information Reliable? 信息可靠吗 (差分约束,spfa)

    题意:有n个站排成一列,针对每个站的位置与距离关系,现有多个约束条件,约束条件分两种:(1)确定的.明确说明站a距离站b多少个单位距离.(2)不确定的.只知道a在b的左边至少1个单位距离.  根据已知 ...

  5. 移动金融APP分析

    最近研究了移动互联网金融APP的情况,分享给大家. 这是官方关于互联网金融的范围,包括支付.借贷.众筹.基金.保险和信托. 典型的APP 绑卡的流程普遍采用的四要素鉴权:姓名,身份证,卡号以及银行预留 ...

  6. WORD中如何让前两页不显示页码

    WORD中如何让前两页不显示页码   上稿人:ojn 点击率: 15191   我们有时在用word编辑文档时,会遇上第一.二页无需显示页码,第三页才是正文的第一页时,该如何正确插入页码呢? 以wor ...

  7. C#的Timer

    PowerCoder 原文 C#的Timer 再C#里现在有3个Timer类: System.Windows.Forms.Timer System.Threading.Timer System.Tim ...

  8. Files

    write public static void write(CharSequence from, File to, Charset charset) throws IOException { asC ...

  9. android操作文件

    Android中读取/写入文件的方法,与Java中的I/O是一样的,提供了openFileInput()和openFileOutput()方法来读取设备上的文件.但是在默认状态下,文件是不能在不同的程 ...

  10. yii中设置提示成功信息,错误提示信息,警告信息

    方法一: <?phpYii::app()->user->setFlash(‘success’,”Data saved!”); 设置键值名为success的临时信息.在getFlash ...