AcWing 1547. 约会
原题链接
简单
作者:
xxxxuu
,
2021-04-19 22:11:01
,
所有人可见
,
阅读 393
#include <iostream>
using namespace std;
int main(){
string s1,s2,s3,s4;
cin>>s1>>s2>>s3>>s4;
string week[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
int i=0;
while(true){//找第一对相同的且能够合法表示星期几的大写字母
if(s1[i]==s2[i] && s1[i]>='A' && s1[i]<='G'){
cout<<week[s1[i]-'A']<<" ";
break;
}
i++;
}
i++;
while(true){
if(s1[i]==s2[i] && (s1[i]>='0' && s1[i]<='9' || s1[i]>='A' && s1[i]<='N')){
if(s1[i]>='0' && s1[i]<='9'){
printf("%02d:",s1[i]-'0');
break;
}
else{
printf("%02d:",10+s1[i]-'A');
break;
}
}
i++;
}
i=0;
while(true){
if(s3[i]==s4[i] && (s3[i]>='a' && s3[i]<='z' || s3[i]>='A' && s3[i]<='Z')){
printf("%02d",i);
break;
}
i++;
}
return 0;
}