PAT (Advanced Level) 1061. Dating (20)

简单模拟。

#include<stdio.h>
#include<string.h> char s1[],s2[],s3[],s4[];
char f[][]={"MON ", "TUE ","WED ","THU ","FRI ","SAT ","SUN "};
int a,b,c,flag; int main()
{
scanf("%s%s%s%s",s1,s2,s3,s4); flag=;
for(int i=;s1[i]&&s2[i];i++) {
if(s1[i]!=s2[i]) continue;
if(flag==) {if(s1[i]>='A'&&s1[i]<='G') a=s1[i]-'A'+,flag=;}
else if(flag==){
if(s1[i]>=''&&s2[i]<='') b=s1[i]-'',flag=;
else if(s1[i]>='A'&&s2[i]<='N') b=s1[i]-'A'+,flag=;
}
}
for(int i=;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-],b,c);
return ;
}
上一篇:IIS下MySQL停止和启动的方法


下一篇:POJ 3261 Milk Patterns(后缀数组+二分答案+离散化)