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 ...
随机推荐
- 一个字符串是否在另外一个字符串数组里 Array.Exists 的用法 Array.IndexOf 用法
转: using System; class Program { static void Main() { string[] array = { "cat", "dot& ...
- mysql 简单介绍
mysql 不允许修改数据库名,一些客户端可以变通的方式来修改数据库名称 mysql 1064错误,语法错误 更改表名: rename table jian to song; 删除表 drop tab ...
- javascript 创建对象的几种方式
1. //基于已有对象扩充其属性和方法var object = new Object(); object.name = "zhangsan"; object.sayName = f ...
- Servlet/Jsp实现购物车
(1)用servlet实现简单的购物车系统,项目结构例如以下:(新建web Project项目 仅仅须要AddItemServlet , ListItemServlet.exam403.jsp三个文 ...
- KISS My YAGNI,KISS (Keep It Simple, Stupid)和 YAGNI (You Ain’t Gonna Need It)软件开发原则
http://www.aqee.net/kiss-my-yagni/我们都知道KISS (Keep It Simple, Stupid)和 YAGNI (You Ain’t Gonna Need It ...
- js open窗口父子窗口操作
http://zhidao.baidu.com/question/61358246.html?an=0&si=1 js open窗口父子窗口操作 父窗口js代码: function ...
- EMQ ---客户端上线自动订阅主题
通过修改配置文件即可实现. emq v2.3.11,软件架构做了调整,把功能集成在了emq_modules模块,/data/loaded_plugins默认会加载emq_modules. 我们只需要改 ...
- SeeSharpTools.JXI.DSP.Spectrum 使用
_spectrumTask.Average.Mode = SeeSharpTools.JXI.DSP.Spectrum.SpectrumAverageMode.PeakHold; // NoAvera ...
- 网站收到的url请求链接,字母全部变为小写
http://www.ithao123.cn/content-5360465.html
- C union共用体
共用体是一种特殊的数据类型,允许您在相同的内存位置存储不同的数据类型.您可以定义一个带有多成员的共用体,但是任何时候只能有一个成员带有值.共用体提供了一种使用相同的内存位置的有效方式. 共用体定义: ...