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. vmware 装 puppy

    说做就做了,但是开始怎么试都没装成功,后来在网上查了些资料,再结合自己的实践,终于成功了.下面我就把如何让Puppy Linux安装到VMware 硬盘上一步一步奉献给大家. 一.准备 1.1 安装好 ...

  2. Centos6虚拟主机的实现

    centos6上虚拟主机的实现   实现虚拟主机有三种方式:基于IP的实现.基于端口的实现.基于FQDN的实现 一.基于IP的实现 1.先创建三个站点: mkdir /app/site1 mkdir ...

  3. CentOS6配置静态IP

    CentOS6配置静态IP 1. 编辑网卡配置 vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=不需要改 TYPE=Et ...

  4. 循环神经网络与LSTM网络

    循环神经网络与LSTM网络 循环神经网络RNN 循环神经网络广泛地应用在序列数据上面,如自然语言,语音和其他的序列数据上.序列数据是有很强的次序关系,比如自然语言.通过深度学习关于序列数据的算法要比两 ...

  5. JS 调用存储过程传递参数

    引用 #region 程序集 Newtonsoft.Json.dll, v4.5.0.0 // E:\Newtonsoft.Json.dll #endregion public DataTable R ...

  6. Codeforces #765D

    我在这道题上花了2个小时,仍没解出.理一下当时的思路,看看症结到底在哪里. 题意 用 $[n]$ 表示集合 $\{1,2,3,\dots, n\}$ . 3个函数 $f \colon [n] \to ...

  7. 刷题总结——table(ssoi)

    题目: 题目背景 SOURCE:NOIP2016-RZZ-2 T2 题目描述 给定一个 n×m 的矩阵,行列均从 1 开始标号. 一个矩阵被认为是稳定的,当且仅当对于任意的 2≤i≤n,第 i 行的数 ...

  8. day2之爬取拉勾网

    认证流程 浏览器清空cookies 步骤一 访问拉勾网网站  https://www.lagou.com/ 做了些什么: 以get方式请求"https://www.lagou.com/&qu ...

  9. 欧拉函数(codevs 4939)

    题目描述 Description 输入一个数n,输出小于n且与n互素的整数个数 输入描述 Input Description 包含多组数据,n=0时结束 测试数据组数不会很多,不必先打表后输出 输出描 ...

  10. 51nod1026 矩阵中不重复的元素 V2

    $n \leq 500000,m \leq 500000$的矩阵,第一行第一列是$a^b,2 \leq a,b \leq 500000$,如果一个数是$i^j$那他右边是$i^{j+1}$,下面是${ ...