#include<cstdio>
#include<cctype>
using namespace std;
char*day[7]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
bool ishour(char c){return c>='0'&&c<='9'||c>='A'&&c<='N';}
bool isday(char c){return c>='A'&&c<='G';}
int main()
{
char s[4][70],i,c;
scanf("%s%s%s%s",s[0],s[1],s[2],s[3]);
for(i=0;;++i)
if(s[0][i]==s[1][i]&&isday(s[0][i])){
printf("%s",day[s[0][i]-'A']);
break;
}
for(++i;;++i)
if(s[0][i]==s[1][i]&&ishour(c=s[0][i])){
printf(" %02d:",(c>='0'&&c<='9')?c-'0':c-'A'+10);
break;
}
for(i=0;;++i)
if(s[2][i]==s[3][i]&&isalpha(s[3][i])){
printf("%02d",i);
break;
}
return 0;
}
注意每次的边界条件
1061. Dating
最新推荐文章于 2020-04-19 17:35:32 发布