hdu 1201:18岁生日(水题,闰年)
18岁生日
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 16784 Accepted Submission(s): 5317
1988-03-07
#include <iostream>
#include <stdio.h>
using namespace std;
bool isr(int y)
{
if(y%==){
if(y%==)
return true;
else
return false;
}
else {
if(y%==)
return true;
else
return false;
}
}
int main()
{
int T;
scanf("%d",&T);
while(T--){
int y,m,d;
scanf("%d-%d-%d",&y,&m,&d);
if(isr(y) && m== && d==){ //唯一没有生日的情况
cout<<-<<endl;
continue;
}
int count = ;
int t = y;
while(t<y+){
if(isr(t)){
if(t==y){ //出生年是闰年
if(m<=) ++count;
}
else if(t==y+){ //18年后是闰年
if(m>=) ++count;
}
else{
++count;
}
}
++t;
}
cout<<*+count<<endl;
}
return ;
}
Freecode : www.cnblogs.com/yym2013
hdu 1201:18岁生日(水题,闰年)的更多相关文章
- HDU 1201 18岁生日 【日期】
18岁生日 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- hdu 1201 18岁生日
#include <stdio.h> int r(int y) { return (y%4==0&&y%100!=0)||(y%400==0); } int f(int y ...
- hdoj 1201 18岁生日
18岁生日 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- 题解报告:hdu1201(18岁生日)
2018-02-24题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1201 Problem Description Gardon的18岁生日就要到了,他 ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 2041:超级楼梯(水题,递归)
超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
随机推荐
- 有关索引的DMV(转)
转自:http://www.cnblogs.com/CareySon/archive/2012/05/17/2505981.html 1.查看那些被大量更新,却很少被使用的索引 SET TRANSAC ...
- Some web Address
1.可视化算法(Data Structure Visualizations) https://www.cs.usfca.edu/~galles/visualization/Algorithms.htm ...
- 从P1到P7——我在淘宝这7年 - 子柳撰写
http://kb.cnblogs.com/page/132752/来自博客园的整理版本,作者是子柳,博客地址:http://blog.sina.com.cn/calvinzhaoc (一) 2011 ...
- C#:转换类型(待补充)
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MyCo ...
- Zepto源代码分析一~核心方法
今天抽出时间复习了一下Zepto的源代码,依照自己的理解进行凝视. 欢迎大家拍砖. 源代码版本号:v1.1.4 源代码下载地址:http://zeptojs.com/ 分析总体代码之后,整理出架构图: ...
- DataGridView 的单元格的边框、 网格线样式的设定
1) DataGridView 的边框线样式的设定DataGridView 的边框线的样式是通过 DataGridView.BorderStyle 属性来设定的. BorderStyle 属性设定值是 ...
- unity, EventType.MouseUp注意事项
如果鼠标移出了窗口范围,则即使鼠标抬起也不会收到EventType.MouseUp消息,所以只写 if(event==EventType.MouseUp){ 执行某操作 } 是错误的,会导致非常奇怪的 ...
- HttpOperater-模拟HTTP操作类
using System; using System.IO; using System.Linq; using System.Net; using System.Text; using System. ...
- GNU C编译器的gnu11和c11
国际标准组织发布c11后,gnu为自己的编译器发布两种标准gnu11和c11 gnu11:带gnu c扩展的c11标准,如果你的代码包含了typeof,__attribute__等等gnu的扩展,就必 ...
- shell获取用户输入
主题: 再学shell之获取用户输入echo -n(不换行)和read命令-p(提示语句) -n(字符个数) -t(等待时间) -s(不回显) 和“读文件”深入学习 1.基本读取read命令接收标准输 ...