1052. 卖个萌 (20)

来源:互联网 发布:华为p7手机壳淘宝 编辑:程序博客网 时间:2024/06/02 05:21
#include<stdio.h>#include<string.h>void read_expression(char arry[][5], int *count){  char temp;  int x=1,i=0;  while((temp = getchar())!='\n')  {    if(temp=='[')    {      i=0;      while((temp = getchar())!=']')      {        arry[x][i++] = temp;      }      arry[x][i] = '\0';      x++;    }    else    {      i=0;      while((temp = getchar())!='[' && temp!='\n');      if(temp=='\n')        break;      while((temp = getchar())!=']' )      {        arry[x][i++] = temp;      }      arry[x][i] = '\0';      x++;    }  }  *count = x-1;}int main(){  char hand[11][5];  char eye[11][5];  char mouth[11][5],temp;  int hand_num=0,eye_num=0,mouth_num=0;  int N=0,i=0,a1,a2,a3,a4,a5;  read_expression(hand, &hand_num);  read_expression(eye, &eye_num);  read_expression(mouth, &mouth_num);    scanf("%d",&N);  while(N--)  {    scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5);    if(a1>hand_num || a2>eye_num || a3>mouth_num ||a4>eye_num ||a5>hand_num)    {      printf("Are you kidding me? @\\/@\n");    }    else if(a1<1 || a2<1 || a3<1 ||a4<1 ||a5<1)    {      printf("Are you kidding me? @\\/@\n");    }    else    {      printf("%s(%s%s%s)%s\n",hand[a1],eye[a2],mouth[a3],eye[a4],hand[a5]);    }  }  return 0;}

0 0