2018CCPC吉林赛区-B

https://vjudge.net/contest/327005#problem/B

12:00am-11:59am

12:00pm-11:59pm

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=1e5+7;
int t,s,f;
string m;
string s1,s2;
int main()
{
    cin>>t;
    for(int k=1;k<=t;k++)
    {
        scanf("%d:%d",&s,&f);
        cin>>m>>s1>>s2;
        if(m[0]=='A'&&s==12) s=0;
        else if(m[0]=='P'&&s!=12) s+=12;
        if(s1=="Moscow") s-=3;
        else if(s1=="Beijing") s-=8;
        else if(s1=="Washington") s+=5;
        if(s2=="Moscow") s+=3;
        else if(s2=="Beijing") s+=8;
        else if(s2=="Washington") s-=5;
        printf("Case %d: ",k);
        if(s<0){
            printf("Yesterday ");
            s+=24;
        }
        else if(s>=24){
            printf("Tomorrow ");
            s-=24;
        }
        else printf("Today ");
        if(s==0) printf("12:%02d AM\n",f);
        else if(s>=1&&s<12) printf("%d:%02d AM\n",s,f);
        else if(s==12) printf("12:%02d PM\n",f);
        else printf("%d:%02d PM\n",s-12,f);
    }
    return 0;
}
View Code

猜你喜欢

转载自www.cnblogs.com/ydw--/p/11529564.html