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 ...
随机推荐
- java 清单文件
Java之jar打包 标签: javajarmanifestmain-classclass-path 2016-03-30 00:29 993人阅读 评论(0) 收藏 举报 分类: Java(6) ...
- jquery获取json对象中的key小技巧,遍历json串所有key,value
比如有一个json var json = {"name" : "Tom", "age" : 18}; 想分别获取它的key 和 value ...
- mysql 禁制远程连接
改表法:把host地址改为% use mysql; update user set host = '%' where user = 'root'and host="127.0.0.1&quo ...
- javascript 图片预加载
<!DOCTYPE > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ...
- 【微信开发】JS和PHP分别判断当前浏览器是否微信浏览器
1.PHP端 //判断是否微信浏览器 -xzz1125 function is_weixin() { if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMes ...
- redis骚操作
1.批量删除key redis-cli -h 127.0.0.1 -p 6379 -n 2 -a sdongpo123 keys '*form_id*' | xargs redis-cli -h 12 ...
- sql查看所有表大小的方法
sql查看所有表大小的方法. 代码: declare @id int ) declare @pages int declare @dbname sysname ,) ,) ,) create tabl ...
- [svc]linux查看主板型号及内存硬件信息
公司服务器内存不够用了. 想看看买啥型号的. 购买内存条注意点: ddr3 or4 频率 块钱. 内存槽及内存条: dmidecode |grep -A16 "Memory Device$& ...
- EF操作VS中
1.安装mysql server 2.安装MySql的VS插件(版本请下载最新版,百度自己搜索,这个不用多说)mysql-for-visualstudio-1.2.3.msi 3.安装用于.net连接 ...
- Python 数据驱动ddt 使用
准备工作: pip install ddt 知识点: 一,数据驱动和代码驱动: 数据驱动的意思是 根据你提供的数据来测试的 比如 ATP框架 需要excel里面的测试用例 代码驱动是必须得写代码 ...