Codeforces Round Intel Code Challenge Final Round A.Checking the Calendar
来源:互联网 发布:淘宝子账号怎么申请 编辑:程序博客网 时间:2024/06/02 07:42
题目大意:问你是否存在一个非闰年,使得某个月的开始为第一行所给的星期,下一个月开始为第二行所给的星期
直接模拟即可。
或者因为每个月天数固定,所以只需要考虑特定的几种情况
#include<set>#include<map>#include<cmath>#include<queue>#include<vector>#include<cstdio>#include<string>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int a[29]={0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int main(){string x1,x2;cin>>x1>>x2;int xx1,xx2;if(x1[0]=='m')xx1=1;else if(x1[0]=='t'&&x1[1]=='u')xx1=2;else if(x1[0]=='w')xx1=3;else if(x1[0]=='t')xx1=4;else if(x1[0]=='f')xx1=5;else if(x1[0]=='s'&&x1[1]=='a')xx1=6;elsexx1=7;if(x2[0]=='m')xx2=1;else if(x2[0]=='t'&&x2[1]=='u')xx2=2;else if(x2[0]=='w')xx2=3;else if(x2[0]=='t')xx2=4;else if(x2[0]=='f')xx2=5;else if(x2[0]=='s'&&x2[1]=='a')xx2=6;elsexx2=7;int i,j;for(i=1;i<=11;i++){int d=xx1;for(j=1;j<=a[i];j++)d=d%7+1;if(d==xx2){printf("YES\n");return 0;}}printf("NO\n");return 0;}
0 0
- Codeforces Round Intel Code Challenge Final Round A.Checking the Calendar
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) -- A. Checking the Calendar(思路)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)A. Checking the Calendar
- Codeforces Round Intel Code Challenge Final Round B.Batch Sort
- Codeforces Round Intel Code Challenge Final Round C. Ray Tracing
- Codeforces Round Intel Code Challenge Final Round D. Dense Subsequence
- Codeforces Intel Code Challenge Final Round C.Ray Tracing
- Codeforces Intel Code Challenge Final Round (Oct/08/2016)
- Intel Code Challenge Final Round B 暴力
- Intel Code Challenge Final Round D 贪心
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Intel Code Challenge Final Round Xor-matic Number of the Graph -- 线性基
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)【A,B,C,D】
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A题
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined)
- Weiss-(DSAA - in C,1.3)字谜游戏
- 为什么你开发的项目要花这么长时间?
- QT的信号/槽机制
- 深入理解Android(一):Gradle详解
- iframe 自适应
- Codeforces Round Intel Code Challenge Final Round A.Checking the Calendar
- SQL注入攻击入门
- Yii正则验证
- 从0开始学习 GITHUB 系列之「加入 GITHUB」
- 本地无法连接服务器mysql数据库
- 毫秒数转时分秒
- 除去集合中的重复数据
- 最新的SSH框架(Spring4.3.3 +Struts2.5.2+Hibernate5.2.3)搭建
- 设计模式(1) 单例模式--创建型