-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1061.cpp
More file actions
34 lines (33 loc) · 804 Bytes
/
1061.cpp
File metadata and controls
34 lines (33 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
string week[7] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
int main(){
ios::sync_with_stdio(false);
string a, b, c, d;
cin>>a>>b>>c>>d;
int i = 0, cnt = 0;
while(i<a.size() && i<b.size()){
if(a[i] == b[i]){
if(cnt==0 && isupper(a[i]) && a[i]<='G'){//注意范围,否则会出错
cout<<week[a[i]-'A']<<' ';
cnt++;
}else if(cnt==1 && isdigit(a[i])){
cout<<setfill('0')<<setw(2)<<(int)(a[i]-'0');
cnt++;
}else if(cnt==1 && isupper(a[i]) && a[i]<='N'){//注意范围,否则会出错
cout<<setfill('0')<<setw(2)<<(int)(a[i]-'A'+10);
cnt++;
}
}else if(cnt == 2) break;
i++;
}
i = 0;
while(i<c.size() && i<d.size()){
if(c[i] == d[i] && isalpha(c[i])){
cout<<':'<<setw(2)<<i;
break;
}
i++;
}
return 0;
}