PAT乙级 1052.卖个萌

#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
char s[1010];
char s1[20][10];
char s2[20][10];
char s3[20][10];
int main()
{
    int z1=0,z2=0,z3=0;
    for(int i=0;i<3;i++)
    {
        gets(s);
        if(i==0)
        {
            for(int j=0;s[j]!='\0';j++)
            {
                if(s[j]=='[')
                {
                    for(int t=j+1,t1=0;s[t]!=']';t++,t1++)
                        s1[z1][t1]=s[t];
                    z1++;
                }
            }
        }
        if(i==1)
        {
            for(int j=0;s[j]!='\0';j++)
            {
                if(s[j]=='[')
                {
                    for(int t=j+1,t1=0;s[t]!=']';t++,t1++)
                        s2[z2][t1]=s[t];
                    z2++;
                }
            }
        }
        if(i==2)
        {
            for(int j=0;s[j]!='\0';j++)
            {
                if(s[j]=='[')
                {
                    for(int t=j+1,t1=0;s[t]!=']';t++,t1++)
                        s3[z3][t1]=s[t];
                    z3++;
                }
            }
        }
    }
    int k=0;
    cin>>k;
    for(int i=0;i<k;i++)
    {
        int a,b,c,d,e;
        cin>>a>>b>>c>>d>>e;
        if(a<=z1&&a>=1&&e>=1&&e<=z1&&b>=1&&b<=z2&&d>=1&&d<=z2&&c>=1&&c<=z3)
            printf("%s(%s%s%s)%s\n",s1[a-1],s2[b-1],s3[c-1],s2[d-1],s1[e-1]);
        else
            cout<<"Are you kidding me? @\\/@\n";
    }
    return 0;
}

发布了45 篇原创文章 · 获赞 1 · 访问量 6785

猜你喜欢

转载自blog.csdn.net/Ls_attack/article/details/79797868
今日推荐