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. Object Pool

    设计模式之美:Object Pool(对象池)   索引 意图 结构 参与者 适用性 效果 相关模式 实现 实现方式(一):实现 DatabaseConnectionPool 类. 意图 运用对象池化 ...

  2. Effective C++(12) 复制对象时要复制每一个成员

    问题聚焦: 负责拷贝的两个操作:拷贝构造函数和重载赋值操作符. 一句话总结,确保被拷贝对象的所有成员变量都做一份拷贝. Demo   void logCall(const std::string&am ...

  3. WinDbg 命令手册

    WinDbg 命令三部曲:(一)WinDbg 命令手册   本文为 Dennis Gao 原创技术文章,发表于博客园博客,未经作者本人允许禁止任何形式的转载. 系列博文 <WinDbg 命令三部 ...

  4. Winform 程序嵌入WPF程序 并发送消息

    废话不多说,先看解决方案目录 WindowsFormsDemo是主程序,WpfApp是嵌入的WPF程序,先看WPF程序,程序默认启动的页面是MainWindow.xaml,这里注释掉App.xaml里 ...

  5. 用Python复习离散数学(二)

    这次复习的是计数问题,立刻走起吧! 1.乘法原理 如果一项工作需要t步完成的,第一步有n1种不同的选择,第二步有n2种不同的选择,……,第t步有nt中不同的选择,那么完成这项工作所有可能的选择种数为: ...

  6. 个人计算机安装hadoop全分布

    一.工具说明 设备:实体主机一台 校园网络 虚拟设备:VMware下安装的ubuntu12.04版本三台,分别是master,slave1,slave2 二.ubuntu安装篇 前提知识:在windo ...

  7. C++拷贝构造函数总结

    C++拷贝构造函数总结 目录: 拷贝构造函数的基础知识 拷贝构造函数的使用 拷贝构造函数的行为 1.拷贝构造函数的基础知识 拷贝构造函数(copy constructor)是构造函数,是拷贝已经存在的 ...

  8. [原]OS X 10.9 Mavericks - Virtual Serial Port Issues

    If want to do iOS kernel debugging on A4 device, first you should install Virtual COM port (VCP) dri ...

  9. 代码高亮插件推荐——SyntaxHighlighter++

    SyntaxHighlighter++这个插件的最大的优点就是可以在编辑器的下方有一个输入框,里面可以输入代码,然后插入到文章中.就不用编辑文章的时候,在可视化和文本之间来回切换了.非常适合不熟悉ht ...

  10. jQuery动态操作表单

    <html> <head> <title>jquery表格操作</title> <script language="javascript ...