A - Calandar

Description

On a planet far away from Earth, one year is composed of 12 months, and each month always consists of 30 days.
Also on that planet, there are 5 days in a week, which are Monday, Tuesday, Wednesday, Thursday and Friday. That is to say, if today is Monday, then tomorrow will be Tuesday, the day after tomorrow will be Wednesday. After 3 days it will be Thursday, after 4 days it will be Friday, and after 5 days it will again be Monday.
Today is the d1d1-th day in the m1m1-th month of year y1y1. Given the day of today on that planet, what day will it be (or was it) on the d2d2-th day in the m2m2-th month of year y2y2 on that planet?

Input

There are multiple test cases. The first line of the input contains an integer TT (about 100), indicating the number of test cases. For each test case:
The first line contains three integers y1y1, m1m1, d1d1 (2000≤y1≤1092000≤y1≤109, 1≤m1≤121≤m1≤12, 1≤d1≤301≤d1≤30) and a string ss, indicating the date and day of today on that planet. It’s guaranteed that ss is either “Monday”, “Tuesday”, “Wednesday”, “Thursday” or “Friday”.
The second line contains three integers y2y2, m2m2 and d2d2 (2000≤y2≤1092000≤y2≤109, 1≤m2≤121≤m2≤12, 1≤d2≤301≤d2≤30), indicating the date whose day we want to know.

Output

For each test case output one line containing one string, indicating the day of the d2d2-th day in the m2m2-th month of year y2y2 on that planet.

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

题目大意

…比较直白

AC代码

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t,a,b,c,a1,b1,c1;
    string s,w[5]={"Monday","Tuesday","Wednesday","Thursday","Friday"};
    cin>>t;
    while(t--)
    {
        cin>>a>>b>>c>>s>>a1>>b1>>c1;
        ll num=(a1-a)*360+(b1-b)*30+c1-c,ans;
        num%=5;
        if(num<0)
            num+=5;
        for(int i=0;i<5;++i)
            if(s==w[i])
            ans=i;
        ans=(ans+num)%5;
        cout<<w[ans]<<endl;
    }
    return 0;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值