An Easy Task

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 17062    Accepted Submission(s): 10902

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.
 
Author
Ignatius.L
 
Recommend
We have carefully selected several similar problems for you:  1021 1097 

pid=1061" target="_blank">1061 1032 1170






题目的意思非常easy:

就是让你求出从Y開始的年份第N个闰年......甚至不用考虑时间复杂度,强行AC!

主要是Debian下命令行不熟悉,费了不少时间......

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int t,Y,N;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&Y,&N);
while(1)
{
if((Y%4==0&&Y%100!=0)||(Y%400==0))
{
N--;
}
if(N==0)
break;
Y++;
}
printf("%d\n",Y);
}
return 0;
}

HDU-1076-An Easy Task(Debian下水题測试.....)的更多相关文章

  1. HDU 1076 An Easy Task

    题解:枚举即可…… #include <cstdio> int main(){ int now,y,n,T,count; scanf("%d",&T); whi ...

  2. 【HDOJ】1076 An Easy Task

    水题,如题. #include <stdio.h> #define chk(Y) (Y%4==0 && Y%100!=0) || Y%400==0 int main() { ...

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

  4. 杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》

    http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2 1.2.5 #include<stdio.h> ...

  5. 九度OJ 1006 ZOJ问题 (这题測试数据有问题)

    题目1006:ZOJ问题 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:15725 解决:2647 题目描写叙述: 对给定的字符串(仅仅包括'z','o','j'三种字符),推断他能否AC ...

  6. An Easy Task(简箪题)

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

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

  8. HDU 2096 小明A+B --- 水题

    HDU 2096 /* HDU 2096 小明A+B --- 水题 */ #include <cstdio> int main() { #ifdef _LOCAL freopen(&quo ...

  9. An Easy Task

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

随机推荐

  1. 数据结构( Pyhon 语言描述 ) — — 第3章:搜索、排序和复杂度分析

    评估算法的性能 评价标准 正确性 可读性和易维护性 运行时间性能 空间性能(内存) 度量算法的运行时间 示例 """ Print the running times fo ...

  2. 杭电 1503 Advanced Fruits

    Description The company "21st Century Fruits" has specialized in creating new sorts of fru ...

  3. python基础学习笔记——初识函数

    什么是函数 我们目前为止,已经可以完成一些软件的基本功能了,那么我们来完成这样一个功能:约x 1 2 3 4 5 pint("拿出手机") print("打开陌陌&quo ...

  4. 对Thymeleaf的一些笼统介绍和理解

    (随手记录的,,可能没那么易看,sorry le) 先大概介绍一下关于Thymeleaf的概念和理解:首先Thymeleaf模板引擎(换句话说他是现代服务器端的Java模板引擎,) 他所对应的主要作用 ...

  5. python基础-文件和目录

    字符串小练习 >>> s="1a2a3a4a5a" >>> s1=s.split('a') >>> >>> ...

  6. c++ 一个cpp文件如何调用另一个cpp文件已经定义的类?我不想重复定义

    文件test1.cpp有类class A;文件test2.cpp有类class B.如在test2.cpp中想用A:#include "test1.cpp" 当然一般的做法是将类的 ...

  7. Codeforces Round #417 (Div. 2) 花式被虐

    A. Sagheer and Crossroads time limit per test 1 second memory limit per test 256 megabytes input sta ...

  8. 移动端没有session怎么处理

    (转:https://my.oschina.net/wanglihui/blog/150726) 手机客户端与服务器端的通信,不同于浏览器与服务器端的通信.浏览器和服务器端的通信依靠session去维 ...

  9. Understanding performance, load and stress testing

    What are performance, load and stress testing? Performance testing, load testing and stress testing ...

  10. 【Luogu】P3708Koishi的数字游戏(数论)

    题目链接 考虑f(i)=i%1+i%2+i%3+.....+i%n f(i+1)=(i+1)%1+(i+1)%2+......+(i+1)%n 其中不是i+1的因数的部分在f(i+1)的地方都加了1. ...