HDU-------An Easy Task
An Easy Task |
| Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) |
| Total Submission(s): 4088 Accepted Submission(s): 2327 |
|
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 Note: if year Y is a leap year, |
|
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 |
|
Sample Output
2108 Hint
We call year Y a leap year only if (Y%4==0 && Y%100!=0) or Y%400==0. |
|
Author
Ignatius.L
|
easy task并不easy 无奈 不过不着急慢慢来 在错误和失败中学到东西才是重要的
上代码
#include <iostream>
using namespace std;
//int leapJudge(int);
int main(){
int cont,sYear,pYear; cin>>cont;
//while(cont--)//这个cont--还是谜一样的存在 !while(i--)中i是有个初值的,每次循环i会减1,当i的值等于0的时候,循环就会终止! for(int i =;i<cont;i++)
{
int sYear = ;
int pYear = ;
cin>>sYear>>pYear;
int leapcont = ; //!!!!!!重大错误就出现在这句 之前把他放在第一层循环外 也是脑子瓦特掉了
int j;
for(j=sYear;;j++){
if(leapcont==pYear) break;
if((j%==&&j%!=)|j%==)//去掉了判断函数 因为确实是没什么卵用
leapcont++;
}
cout<<j-<<endl;//此处也是有一个错误 应该输出j-1
}
//system("pause");
return ;
}
//int leapJudge(int Y){
// if( (Y%4==0 && Y%100!=0)||Y%400==0)
// return 1;
//} //#include<iostream>
//using namespace std;
//
//int main()
//{
// int cases;//
// int k;
// cin>>cases;
// while(cases--)
// {
// int y,n;
// cin>>y>>n;
// int num=0;
// for(k=y;;k++)
// {
// if(num==n) break;
// //判断是不是闰年
// if(k%4==0 && k%100!=0 || k%400==0)
// num++;
// }
// cout<<k-1<<endl;
// }
// system("pause");
// return 0;
//}
总结:循环之间的逻辑不清晰
HDU-------An Easy Task的更多相关文章
- 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 ...
- 二分+DP HDU 3433 A Task Process
HDU 3433 A Task Process Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- An Easy Task
An Easy Task Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- hdu 3433 A Task Process 二分+dp
A Task Process Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- ZOJ 2969 Easy Task
E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...
- An Easy Task(简箪题)
B. An Easy Task Time Limit: 1000ms Case Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO f ...
- HDU-1076-An Easy Task(Debian下水题測试.....)
An Easy Task Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- Codeforces 263A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input ...
- 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 ...
随机推荐
- [推荐分享]大量Javascript/JQuery学习教程电子书合集,送给有需要的人
不收藏是你的错^_^. 经证实,均可免费下载. 资源名称 资源大小 15天学会jQuery(完整版).pdf 274.79 KB 21天学通JavaScript(第2版)-顾宁燕扫描版.pdf ...
- Extjs表单控件入门
ExtJs表单控件用formPanel来做为表单元素的容器.默认情况下,是使用Ajax异步提交. 大家知道要使用Extjs必须引入他的库,所以我们要引入以下几个文件: ext-all.css ext- ...
- AgileEAS.NET SOA中间件平台/敏捷软件开发平台
AgileEAS.NET SOA中间件平台/敏捷软件开发平台 最新下载 一.前言 AgileEAS.NET SOA中间件平台,简称EAS.NET,是基于敏捷并行开发思想和Microsoft .Net构 ...
- elasticsearch文档-analysis
elasticsearch文档-analysis analysis 基本概念 全文搜索引擎会用某种算法对要建索引的文档进行分析, 从文档中提取出若干Token(词元), 这些算法称为Tokeniz ...
- 上传文件大小限制,webconfig和IIS配置大文件上传
IIS6下上传大文件没有问题,但是迁移到IIS7下面,上传大文件时,出现HTTP 404错误. IIS配置上传大小,webconfig <!-- 配置允许上传大小 --><httpR ...
- Linux环境进程间通信(一):管道及命名管道
linux下进程间通信的几种主要手段: 管道(Pipe)及有名管道(named pipe):管道可用于具有亲缘关系进程间的通信,有名管道克服了管道没有名字的限制,因此,除具有管道所具有的功能外,它还允 ...
- TortoiseSVN使用方法 安装和配置
TortoiseSVN使用方法 安装和配置 TortoiseSVN的下载地址为 http://tortoisesvn.net/downloads.html 有32位和64位的版本,一定要根据自己的 ...
- UIButton根据不同的状态设置layer
这需要用到KVO,监听button的highlighted属性的变化,在监听回调里根据监听到得属性值设置layer 设置监听如下 [button addObserver:self forKeyPat ...
- JS二维数据处理逻辑封装探究
一.目的 定义出一个专门用于处理二维数据的组件,所谓二维数据就是能用二维表格显示出来的数据,所谓处理就是增删改查,很简单. 二.约束 外部程序给该组件传入如下形式的对象,让该组件自行解析. var t ...
- springMVC3学习(三)--handlerMapping和handlerAdapter
基本结构和 springMVC3学习(一)--框架搭建 差不多,这里不再用Annotation注解的方式 以下只说明需要修改的部分: 1.在Spring配置文件中配置HandlerMapping.Ha ...