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 ...
随机推荐
- windows配置meld
meld 官网:http://meldmerge.org/ git配置: git bash: git config --global merge.tool meld ...
- excel 根据单元格内容自动调整列宽
excel 根据单元格内容自动调整列宽 CreateTime--2018年5月28日08:49:40 Author:Marydon 1.情景展示 单元格宽度超过了列宽 2.解决方案 第一步:同时选 ...
- JDBC 获取被插入数据的主键ID值
除了用存储过程还有以下方法可以获取: static int create() throws SQLException { Connection conn = null; Pre ...
- 【Redis】windows环境下安装redis服务器,并配置php的redis扩展
win7示例: 1.下载Redis服务器 : https://github.com/dmajkic/redis/downloads:(随便下,建议不要太老的) 2.在D:\phpStudy\ 新建Re ...
- HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr
http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/core/org.eclipse.smila.solr/code/为什么要对实例管理 ...
- window.open()函数
http://hi.baidu.com/gagahjt/blog/item/7b76e0dee61b20aecd11661c.html open函数详解: window.open("sUrl ...
- react native window下的环境搭建和调试方案
这几天使用react native开发app,遇到一些坑,先记录下来,以后再继续补充 环境搭建 打开react native中文网,发现环境搭建特么也太复杂了,安装各种插件/软件,对于我们 编辑器+浏 ...
- nginx实战二
nginx架构分析 1.nginx模块化 Nginx涉及到的模块分为核心模块.标准HTTP模块.可选HTTP模块.邮件服务模块以及第三方模块等五大类. https://coding.net/u/ami ...
- 如何让maven 将工程依赖的jar 复制到WEB-INF/lib 目录下
1.在默认生命周期的compile阶段执行 maven-dependency-plugin:copy-dependencies命令即可:<plugin><groupId>org ...
- php回调函数原理和实例
原理 自己调用自己 称之为“递归”,而不是回调 你也知道回调的关键是这个回既然是回,那么就有一个谁是主体的问题,因为回调是往回调用的意思我调用了函数A,而函数A在执行过程中调用了我提供的函数B,这个函 ...