1014 福尔摩斯的约会

在这里插入图片描述
在这里插入图片描述

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    char str1[60],str2[60],str3[60],str4[60];
    cin>>str1>>str2>>str3>>str4;
    int len1=strlen(str1);
    int len2=strlen(str2);
    int len3=strlen(str3);
    int len4=strlen(str4);
    int len5,len6;
    if(len1>len2)
    {
        len5=len2;
    }
    else
    {
        len5=len1;
    }
    if(len3>len4)
    {
        len6=len4;
    }
    else
    {
        len6=len3;
    }
    char day;
    int shi;
    int j1;
    for(j1=0;j1<len5;j1++)
    {
        int pp=str1[j1];
        if(str1[j1]==str2[j1]&&pp>=65&&pp<=71)
        {
            day=str1[j1];
            break;
        }
    }
    for(int j3=j1+1;j3<len5;j3++)
    {
        int p1=str1[j3];
        int p2=str2[j3];
        if((p1==p2)&&((p1>=48&&p1<=57)||(p1>=65&&p1<=78)))
        {
            shi=p1;
            break;
        }
    }
    if(day=='A')
    {
        cout<<"MON ";
    }
    else if(day=='B')
    {
        cout<<"TUE ";
    }
    else if(day=='C')
    {
        cout<<"WED ";
    }
    else if(day=='D')
    {
        cout<<"THU ";
    }
    else if(day=='E')
    {
        cout<<"FRI ";
    }
    else if(day=='F')
    {
        cout<<"SAT ";
    }
    else if(day=='G')
    {
        cout<<"SUN ";
    }
    if(shi>=48&&shi<=56)
    {
        shi=shi-48;
        cout<<"0"<<shi<<":";
    }
    else if(shi>=65&&shi<=78)
    {
        shi=shi-55;
        cout<<shi<<":";
    }
    int fen;
    for(int j2=0;j2<len6;j2++)
    {
        int p=str3[j2];
        if(str3[j2]==str4[j2]&&((p<=90&&p>=65)||(p>=97&&p<=122)))
        {
            fen=j2;
            break;
        }
    }
    if(fen<10)
    {
        cout<<"0"<<fen;
    }
    else
    {
        cout<<fen;
    }
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值