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 ...
随机推荐
- 如何下载flash离线安装包
如何下载flash离线安装包 CreateTime--2018年4月14日16:02:13 Author:Marydon 1.下载地址 UpdateTime--2018年5月13日16点55分 p ...
- 位(bit)与字节(byte)
bit就是位,也叫比特位,是计算机表示数据最小的单位. byte就是字节,1byte=8bit,1byte就是1B: 一个字符=2字节: 1KB=1024B 一个英文字母,无论大写和小写都是一个字符: ...
- 【Redis】redis+php处理高并发,很好的教程||附上 php的文件锁
链接至:http://blog.csdn.net/nuli888/article/details/51865401 很好的教程,其中redis+php有点小问题. 附上php文件锁: $fp = fo ...
- SyntaxError: Non-ASCII character '\xe5' in file index.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
python入门,hhh 在慕课网上学习python入门,编写汉诺塔的递归调用时,代码正确.但是加上注释后编译不通过 报如下错误: SyntaxError: Non-ASCII character , ...
- Ubuntu下设置redis让其他服务器访问
修改redis配置文件,将 bind 127.0.0.1to bind 0.0.0.0Then restart your service (service redis-server restart) ...
- Linux-软件包管理-脚本安装包
打开网页: http://sourceforge.net/projects/webadmin/files/webmin/下载1.6.10软件包 下载并放到linux系统中 ls 查看当前目录下所有信息 ...
- MySQL-Transfer2.3发布
Transfer 2.3发布,下载地址 此版本除了升级based版本外 *优化了无索引表的同步性能 *优化了slave模式下超大事务内存消耗问题 *Transfer模式相关的功能改动较多 *修复tra ...
- Genral log(普通日志)与 Slow log(慢速日式)
General log: Geleral log记录了服务器接收到的每一个查询或是命令,无论这些查询或是命令是否正确甚至是否包含语法错误,general log 都会将其记录下来 ,记录的格式为 {T ...
- atitit.手动配置列表文件的选择and 数据的层次结构 attilax总结最佳实践--yaml
atitit.手动配置列表文件的选择and 数据的层次结构 attilax总结最佳实践--yaml 1. yaml是个好的选择.. 1 2. 数据的层次结构--结构:hash,list,和block ...
- [svc]linux测速软件speedtest-cli
linux测速软件: https://github.com/sivel/speedtest-cli 以下是我在gentoo上测的