Description:
Input
Output
Sample Input
4 2019 5 12 Monday 2019 5 14 2019 5 12 Tuesday 2019 12 30 2019 5 12 Friday 1000000000 1 1 1000000000 1 1 Wednesday 2019 5 12
Sample Output
Wednesday Friday Thursday Thursday
题意:
给出当前日期是周几,求目标日期是周几。
这个题的坑是一个月是30天,一周五天,只要判断相差的天数对5取模就行了,
ac代码:
#include<iostream>
#include<math.h>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long ll;
string s[5]={"Monday","Tuesday","Wednesday","Thursday","Friday"};
int main()
{
ll y1,y2,m1,m2,d1,d2;
int i;
int t;
string m;
scanf("%d",&t);
while(t--)
{
cin>>y1>>m1>>d1>>m;
cin>>y2>>m2>>d2;
ll d=d2+30-d1;
d%=5;
if(m=="Monday")
d+=5;
if(m=="Tuesday")
d+=5+1;
if(m=="Wednesday")
d+=5+2;
if(m=="Thursday")
d+=5+3;
if(m=="Friday")
d+=5+4;
cout<<s[d%5]<<endl;
}
return 0;
}
标签:12,Friday,Wednesday,Thursday,include,2019,Calandar,ZOJ4113,模拟 From: https://blog.51cto.com/u_15952369/6036935