• A


    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 d_1d1-th day in the m_1m1-th month of year y_1y1. Given the day of today on that planet, what day will it be (or was it) on the d_2d2-th day in the m_2m2-th month of year y_2y2 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 y_1y1m_1m1d_1d1 (2000 le y_1 le 10^92000y1109, 1 le m_1 le 121m112, 1 le d_1 le 301d130) 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 y_2y2m_2m2 and d_2d2 (2000 le y_2 le 10^92000y2109, 1 le m_2 le 121m212, 1 le d_2 le 301d230), 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 d_2d2-th day in the m_2m2-th month of year y_2y2 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

    代码     ps:只需要看day,与year和month无关

     1 #include<iostream>
     2 using namespace std;
     3 int main(){
     4     int t;
     5     int y,m,d;
     6     int y1,m1,d1;
     7     char s[10];
     8     scanf("%d",&t);
     9     while(t--){
    10         scanf("%d %d %d %s",&y,&m,&y,s);
    11         scanf("%d %d %d",&y1,&m1,&y1);
    12         int n=(y1-y)%5;
    13         int k;
    14         if(s[0]=='M') k=0;
    15         else if(s[0]=='T'&&s[1]=='u') k=1;
    16         else if(s[0]=='W') k=2;
    17         else if(s[0]=='T'&&s[1]=='h') k=3;
    18         else if(s[0]=='F') k=4;
    19         if(n<=0) k=(k+5+n)%5;
    20         else k=(k+n)%5;
    21         if(k==0) printf("Monday
    ");
    22         else if(k==1) printf("Tuesday
    ");
    23         else if(k==2) printf("Wednesday
    ");
    24         else if(k==3) printf("Thursday
    ");
    25         else if(k==4) printf("Friday
    ");
    26     }
    27 }
  • 相关阅读:
    .NET控件ZedGraph使用帮助
    .NET多线程编程(转)
    DataTable 添加列、设置主键、添加行、查询、更新
    一个有用的Windows服务小程序——用来完成Server端的Socket通信[转载]
    (周星驰版)学习委托的最好实例 (转载+自己补充了注释)
    这样写
    DataTable添加列和行的方法
    简单工厂之简单模型(uml)
    学了delegate委托还有event事件的联系,基本学明白了。先总结一下吧。[转载]
    HDU_1240——三维空间DFS
  • 原文地址:https://www.cnblogs.com/-happy-/p/12517839.html
Copyright © 2020-2023  润新知