1052 卖个萌 (20 分)

#include

int main()

{
    char szHand[10][5]={0};
    char szEye[10][5]={0};
    char szMouth[10][5]={0};
    char temp=0;

    int iHand=0,iEye=0,iMouth=0;//字符计数

    while((temp=getchar())!='\n')
    {
        if(temp=='[')
            scanf("%[^]]",&szHand[iHand++]);
    }

    while((temp=getchar())!='\n')
    {
        if(temp=='[')
            scanf("%[^]]",&szEye[iEye++]);
    }

    while((temp=getchar())!='\n')
    {
        if(temp=='[')
            scanf("%[^]]",&szMouth[iMouth++]);
    }


    int K;
    scanf("%d", &K);

    int i, j;
    int choose[6]={0};
    for(i=0; i0 && choose[0]<=iHand
           && choose[1]>0 && choose[1]<=iEye
           && choose[2]>0 && choose[2]<=iMouth
           && choose[3]>0 && choose[3]<=iEye
           && choose[4]>0 && choose[4]<=iHand)
        {
            printf("%s", szHand[choose[0]-1]);
            printf("(%s", szEye[choose[1]-1]);
            printf("%s", szMouth[choose[2]-1]);
            printf("%s)", szEye[choose[3]-1]);
            printf("%s", szHand[choose[4]-1]);
        }
        else
        {
            printf("Are you kidding me? @\\/@");
        }
        if(i < K-1)
        {
            printf("\n");
        }

    }

  return 0;

}

你可能感兴趣的:(1052 卖个萌 (20 分))