HDU-1076-An Easy Task(Debian下水题測试.....)
2024-08-29 23:05:53
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.
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).
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
43236HintWe 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
题目的意思非常easy:
就是让你求出从Y開始的年份第N个闰年......甚至不用考虑时间复杂度,强行AC!
主要是Debian下命令行不熟悉,费了不少时间......
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;
}
最新文章
- Linux(四)__javaee开发环境的搭建
- linux系统磁盘分区之parted
- Unity3d在安卓android的更新(APK覆盖)
- SSAS 发布报错处理方法 Login failed for user &#39;NT Service\MSSQLServerOLAPService&#39; 28000
- 【QT相关】类头文件解读、QT编辑模式、读取text文本
- LR的VG与Control之间的关系,并发的实质
- zf-删除重复数据只保留一条(转)
- Oracle-SQL-按月统计自助终端交易量
- 【憩园】C#并发编程之异步编程(二)
- springboot ****使用经验*******
- angular.isObject()
- Mysql加锁过程详解(1)-基本知识
- 异常来自 HRESULT:0x80070057 (E_INVALIDARG)(转)
- spark_wordcount
- A1070. Mooncake
- python - class内置方法 doc/module/del(析构方法)/cal 方法
- js判断软键盘是否开启弹出
- SpingMVC的<;context:component-scan>;包扫描踩坑记录
- 将keras模型在django中应用时出现的小问题——ValueError: Tensor Tensor(";dense_2/Softmax:0";, shape=(?, 8), dtype=float32) is not an element of this graph.
- 01—为什么使用java
热门文章
- 数据结构( Pyhon 语言描述 ) — — 第1章:Python编程基础
- Jmeter接口测试-简单分析结果数、聚合报告以及图形结果(二)
- C# 字符串型转数字型
- BZOJ 1829 [Usaco2010 Mar]starc星际争霸 ——半平面交
- [BZOJ1582] [Usaco2009 Hol]Holiday Painting 节日画画(线段树)
- HashTable的构造函数有哪些
- bzoj2144 跳跳棋 二分
- IBM内存三技术:Chipkill、MPX、MM
- 费用流(bzoj 3130)
- Resin Thread Dump