美文网首页
PAT1014打卡-0917

PAT1014打卡-0917

作者: 可爱的甜甜猪 | 来源:发表于2020-09-17 19:17 被阅读0次

    #include <iostream>

    #include <string>

    using namespace std;

    int day(char a)

    {

    if(a=='A')

    return 1;

    if(a=='B')

    return 2;

    if(a=='C')

    return 3;

    if(a=='D')

    return 4;

    if(a=='E')

    return 5;

    if(a=='F')

    return 6;

    if(a=='G')

    return 7;

    }

    int main()

    {

    string a;

    string b;

    string c;

    string d;

    cin>>a;

    cin>>b;

    cin>>c;

    cin>>d;

    int a1=a.size();

    int b1=b.size();

    int c1=c.size();

    int d1=d.size();

    char a2,b2;

    int c2;

    int flag0=0,flag1=0;

    for(int i=0;i<a1;i++)

    {

    if(a[i]==b[i]&&flag0==0&&a[i]>='A'&&a[i]<='G')

    {

    a2=a[i];

    flag0++;

    }

    else if(a[i]==b[i]&&flag0==1)

    {

    if((a[i]>='A'&&a[i]<='N')||(a[i]>='0'&&a[i]<='9'))

    {

    b2=a[i];

    break;

    }

    }

    }

    for(int i=0;i<c1;i++)

    {

    if(c[i]==d[i])

    {

    if((c[i]>='A'&&c[i]<='Z')||(c[i]>='a'&&c[i]<='z'))

    {

    c2=i;

    break;

    }

    }

    }

    int date=day(a2);

    if(date==1)

    cout<<"MON";

    if(date==2)

    cout<<"TUE";

    if(date==3)

    cout<<"WED";

    if(date==4)

    cout<<"THU";

    if(date==5)

    cout<<"FRI";

    if(date==6)

    cout<<"SAT";

    if(date==7)

    cout<<"SUN";

    cout<<" ";

    if(b2>='0'&&b2<='9')

    {

    cout<<0<<b2;

    }

    int b22=10;

    if(b2>='A'&&b2<='N')

    {

    for(char b222='A';b222<='N';b222++)

    {

    if(b2==b222)

    break;

    else

    b22++;

    }

    cout<<b22;

    }

    cout<<":";

    if(c2>=0&&c2<=9)

    cout<<0<<c2;

    else

    cout<<c2;

    return 0;

    }

    相关文章

      网友评论

          本文标题:PAT1014打卡-0917

          本文链接:https://www.haomeiwen.com/subject/ssrryktx.html