简单模拟。
#include<stdio.h> #include<string.h> char s1[70],s2[70],s3[70],s4[70]; char f[7][5]={"MON ", "TUE ","WED ","THU ","FRI ","SAT ","SUN "}; int a,b,c,flag; int main() { scanf("%s%s%s%s",s1,s2,s3,s4); flag=0; for(int i=0;s1[i]&&s2[i];i++) { if(s1[i]!=s2[i]) continue; if(flag==0) {if(s1[i]>=‘A‘&&s1[i]<=‘G‘) a=s1[i]-‘A‘+1,flag=1;} else if(flag==1){ if(s1[i]>=‘0‘&&s2[i]<=‘9‘) b=s1[i]-‘0‘,flag=2; else if(s1[i]>=‘A‘&&s2[i]<=‘N‘) b=s1[i]-‘A‘+10,flag=2; } } for(int i=0;s3[i]&&s4[i];i++){ if(s3[i]==s4[i]&&(s3[i]>=‘a‘&&s3[i]<=‘z‘)||(s3[i]>=‘A‘&&s3[i]<=‘Z‘)) { c=i;break; } } printf("%s%02d:%02d\n",f[a-1],b,c); return 0; }
时间: 2024-10-10 11:47:42