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

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的更多相关文章

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

  2. 二分+DP HDU 3433 A Task Process

    HDU 3433 A Task Process Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  3. An Easy Task

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

  4. hdu 3433 A Task Process 二分+dp

    A Task Process Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  5. ZOJ 2969 Easy Task

    E - Easy Task Description Calculating the derivation of a polynomial is an easy task. Given a functi ...

  6. An Easy Task(简箪题)

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

  7. HDU-1076-An Easy Task(Debian下水题測试.....)

    An Easy Task Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tot ...

  8. Codeforces 263A. Appleman and Easy Task

    A. Appleman and Easy Task time limit per test  1 second memory limit per test  256 megabytes input  ...

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

随机推荐

  1. RMAN duplicate from active 时遭遇 ORA-17627 ORA-12154

    最近在从活动数据库进行异机克隆时碰到了ORA-17629,ORA-17627,ORA-12154的错误,起初以为是一个Bug呢.Oracle Bug着实太多了,已经成了习惯性思维了.汗!错误提示是无法 ...

  2. STL非变易算法 - STL算法

    欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1394600460.html 原创:ST ...

  3. sequence diagram

    [UML]UML系列——时序图(顺序图)sequence diagram 系列文章 [UML]UML系列——用例图Use Case [UML]UML系列——用例图中的各种关系(include.exte ...

  4. git命令与github使用

    GitHub 是一个类似 SourceForge 的免费项目管理及分享的服务平台,要想使用 github,用户可以免费注册成为 github 注册用户,之后使用git命令进行操作使用.github 的 ...

  5. codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法

    codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法 进入nginx的配置文件 加上一句(本来就有这句,只需要修改一下就行了) locatio ...

  6. iOS Web开发激活css的active伪类

    最近在做一个资讯客户端,用到UIWebview展示一些网页内容,本来想做一个简单的按压效果,发现在css中设置active属性一直不管用. 查阅了一下资料,今天发现,要让css active伪类生效, ...

  7. js中的AMD规范

    回首萧瑟,残月挂角,孤草弄影. 看了一下上一篇随笔的日期,距离上一篇日志又过去了许久.在这段时间中,我尽全力去拯救那间便利店,可惜到最后依然失败,这一次是所有的出路全部没有了,我也做了所有的努力.闲下 ...

  8. 合约广告系统-Hadoop

    Hadoop Hadoop 概况 Hadoop 由 Apache Software Foundation 公司于 2005 年秋天作为Lucene的子项目 Nutch的一部分正式引入.它受到最先由 G ...

  9. struts2讲义----建立一个struts2工程

    建立一个Struts2 工程 Ø 1在MyEclipse中新建web工程 Ø 2在struts-2.2.1.1-all\struts-2.2.1.1解压struts2-blank.war( 最基础的示 ...

  10. 使用Reactive Extensions(Rx),对短时间内多次发生的事件限流

    使用Reactive Extensions(Rx),对短时间内多次发生的事件限流 牛刀小试:使用Reactive Extensions(Rx),对短时间内多次发生的事件限流 我之前有一篇文章介绍到了R ...