感受
毒
瘤
出
题
人
,
时
间
处
理
成
这
样
也
是
服
了
。
毒瘤出题人,时间处理成这样也是服了。
毒瘤出题人,时间处理成这样也是服了。
思路
12
:
00
A
M
−
−
−
00
:
00
12:00AM---00:00
12:00AM−−−00:00
01
:
00
A
M
−
−
−
01
:
00
01:00AM---01:00
01:00AM−−−01:00
.
.
.
.
.
.
......
......
12
:
00
P
M
−
−
−
12
:
00
12:00PM---12:00
12:00PM−−−12:00
01
:
00
P
M
−
−
−
13
:
00
01:00PM---13:00
01:00PM−−−13:00
.
.
.
.
.
.
......
......
11
:
00
P
M
−
−
−
23
:
00
11:00PM---23:00
11:00PM−−−23:00
知
道
这
个
,
那
么
就
直
接
模
拟
吧
。
知道这个,那么就直接模拟吧。
知道这个,那么就直接模拟吧。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
const int maxn = 200;
int kase, h, x, y;
string tim, opt, s1, s2;
int a[] = {0, 8, -5, 0, 3};
int get(char s){
if(s == 'B') return 1;
else if(s == 'W') return 2;
else if(s == 'L') return 3;
else return 4;
}
/**
12:00 AM = 00:00
~
12:00 PM = 12:00
~
*/
void solve(int h, int d){
string flag;
if(d >= 0){
h += d;
if(h >= 24){
flag = "Tomorrow";
h -= 24;
}
else{
flag = "Today";
}
}
else{
h += d;
if(h < 0){
flag = "Yesterday";
h += 24;
}
else{
flag = "Today";
}
}
if(h < 12) opt = "AM";
else opt = "PM";
if(h == 0) h = 12;
if(h > 12) h -= 12;
printf("Case %d: ", kase);
cout << flag; printf(" %d:", h);
cout << tim << " " << opt << endl;
}
int main(){
int t; kase = 0;
scanf("%d", &t);
while(t--){
kase++;
scanf("%d:", &h);
cin >> tim >> opt >> s1 >> s2;
h %= 12;
if(opt[0] == 'P'){
h += 12;
}
x = get(s1[0]); y = get(s2[0]);
solve(h, a[y] - a[x]);
}
return 0;
}
/**
12:00 AM = 00:00
~
12:00 PM = 12:00
~
*/