博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU-1076-An Easy Task(Debian下水题測试.....)
阅读量:6214 次
发布时间:2019-06-21

本文共 1488 字,大约阅读时间需要 4 分钟。

 

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:          
题目的意思非常easy:
就是让你求出从Y開始的年份第N个闰年......甚至不用考虑时间复杂度,强行AC!
主要是Debian下命令行不熟悉,费了不少时间......
#include
#include
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;}

转载地址:http://wasja.baihongyu.com/

你可能感兴趣的文章
IntelliJ Idea 常用快捷键列表
查看>>
使用Spring定时任务并且通过AOP监控任务执行情况
查看>>
ASP.NET MVC做的微信WEBAPP中调用微信JSSDK扫一扫
查看>>
牛腩代码生成器
查看>>
【SpringMVC架构】SpringMVC入门实例,解析工作原理(二)
查看>>
P1719 最大加权矩形
查看>>
为Android Studio设置HTTP代理
查看>>
Arcgis for JS之Cluster聚类分析的实现
查看>>
远程桌面连接保存登陆用户以及密码(凭据)备份方法
查看>>
R0~R16寄存器作用
查看>>
data-packed volume container - 每天5分钟玩转 Docker 容器技术(43)
查看>>
hdu-2066-一个人的旅行
查看>>
Docker实践(5)—资源隔离
查看>>
RecyclerView
查看>>
Halcon学习之边缘检测函数
查看>>
从错误中学python(4)——最小公约数与辗转相除法
查看>>
5步玩转Power BI Embedded,老司机全程带路解析
查看>>
Vue学习目录
查看>>
[js高手之路] 设计模式系列课程 - 迭代器(1)
查看>>
从#65279字符看dede模板页面编码问题
查看>>