hdu1491 Octorber 21st (模拟问题)
来源:互联网 发布:山西大学网络管理系统 编辑:程序博客网 时间:2024/06/17 00:54
题目意思:
http://acm.hdu.edu.cn/showproblem.php?pid=1491
给出两个数,分别表示月和日,求出改天距离10.21的天数,如果就是10.21,输出
It's today!!如果改天超过10.21,输出:
What a pity, it has passed!题目分析:
直接模拟,先月后天,注意10月即可,见代码。
AC代码:
/** *@xiaoran *模拟 */#include<iostream>#include<cstdio>#include<map>#include<cstring>#include<string>#include<algorithm>#include<queue>#include<vector>#include<stack>#include<cstdlib>#include<cctype>#include<cmath>#define LL long longusing namespace std;const int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int main(){ int m,d,t; cin>>t; while(t--){ cin>>m>>d; if(m==10&&d==21){//It is today! cout<<"It's today!!"<<endl; continue; } if((m==10&&d>21)||m>10){ cout<<"What a pity, it has passed!"<<endl; continue; } int sum=0; for(int i=m+1;i<10;i++){//加上相差的月的天数 sum+=a[i]; } if(m==10) sum+=21-d;//加上十月的21天 else{ sum+=a[m]-d;//加上本月剩余的天数 sum+=21; } cout<<sum<<endl; }return 0;}
0 0
- hdu1491 Octorber 21st (模拟问题)
- HDU1491 Octorber 21st【水题】
- hdu Octorber 21st
- hdoj Octorber 21st
- HDOJ1491 Octorber 21st
- hdu 1491(Octorber 21st)(模拟水题)
- HDU 1491 Octorber 21st
- hdu 1491 Octorber 21st
- HDU 1491 Octorber 21st
- 201412021749-hd-Octorber 21st
- HDU 1491 Octorber 21st
- HDU 1491 Octorber 21st
- HDOJ 1491 Octorber 21st
- Hdoj 1491 Octorber 21st
- hdu-oj 1491 Octorber 21st
- hdoj.1491 Octorber 21st 20140825
- HDU 1491 Octorber 21st【计算日期】
- hdu 1491 Octorber 21st(数学题)
- JSP page指令详解
- 图形处理 使用drawBitmapMesh扭曲图像
- PHP基础知识(一)
- 小明的烦恼
- iOS-GCD多线程编程详解2
- hdu1491 Octorber 21st (模拟问题)
- 背包问题
- Win7和Centos7 安装后修改系统默认引导设置
- #define中只有一个参数何解?
- 视频:《噬神者2:狂怒解放》公开游戏开场动画欣赏
- Kafka使用及开发概要
- 树莓派8188eu驱动
- Android Context 上下文 你必须知道的一切
- 5个数求最值