PAT(Basic Level)_1014_福尔摩斯的约会

#include<stdio.h>
#include<string.h>

int main(){
    char str1[61],str2[61],str3[61],str4[61];
    char week[7][5]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
    scanf("%s%s%s%s",str1,str2,str3,str4);

    int i,flag=0;
    for(i=0;str1[i] && str2[i];i++){
        if(str1[i]==str2[i]){
            if(!flag && str1[i]>='A' && str1[i]<='G'){
                flag=1;
                printf("%s ",week[str1[i]-'A']);
            }
            else if(flag){
                if(str1[i]>='0' && str1[i]<='9'){
                    printf("%02d:",str1[i]-'0');
                    break;
                }
                else if(str1[i]>='A' && str1[i]<='N'){
                    printf("%02d:",str1[i]-'A'+10);
                    break;
                }
            }
        }
    }

    for(i=0;str3[i] && str4[i];i++){
        if(str3[i]==str4[i]){
            if((str3[i]>='a'&&str3[i]<='z')
            ||(str3[i]>='A'&&str3[i]<='Z')){
                printf("%02d",i);
            }
        }
    }

    return 0;
}
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/HOH_mizukun/article/details/75810803
文章标签: acm pat 1014
个人分类: ACM
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭