1052. 卖个萌 (20)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的:
[左手]([左眼][口][右眼])[右手]
现给出可选用的符号集合,请你按用户的要求输出表情。
输入格式:
输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号[]内。题目保证每个集合都至少有一个符号,并不超过10个符号;每个符号包含1到4个非空字符。
之后一行给出一个正整数K,为用户请求的个数。随后K行,每行给出一个用户的符号选择,顺序为左手、左眼、口、右眼、右手——这里只给出符号在相应集合中的序号(从1开始),数字间以空格分隔。
输出格式:
对每个用户请求,在一行中输出生成的表情。若用户选择的序号不存在,则输出“Are you kidding me? @\/@”。
输入样例:[╮][╭][o][~\][/~] [<][>] [╯][╰][^][-][=][>][<][@][⊙] [Д][▽][_][ε][^] ... 4 1 1 2 2 2 6 8 1 5 5 3 3 4 3 3 2 10 3 9 3输出样例:
╮(╯▽╰)╭ <(@Д=)/~ o(^ε^)o Are you kidding me? @\/@
/*
根据题目要求匹配上就可以,但模拟过程巨烦
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int i,j=0,k,m=0,n=0,tem,count,**p;
char str[3][100]={'\0'},hand[10][5]={'\0'},eye[10][5]={'\0'},month[10][5]={'\0'},face[21]={'\0'};
for(i=0;i<3;i++)
gets(str[i]);
while(str[0][j]!='\0')
{
if(str[0][j]=='[')
{
j++;
n=0;
while(str[0][j]!=']')
{
hand[m][n]=str[0][j];
n++;
j++;
}
m++;
}
j++;
}
m=0;
j=0;
while(str[1][j]!='\0')
{
if(str[1][j]=='[')
{
j++;
n=0;
while(str[1][j]!=']')
{
eye[m][n]=str[1][j];
n++;
j++;
}
m++;
}
j++;
}
m=0;
j=0;
while(str[2][j]!='\0')
{
if(str[2][j]=='[')
{
j++;
n=0;
while(str[2][j]!=']')
{
month[m][n]=str[2][j];
n++;
j++;
}
m++;
}
j++;
}
scanf("%d",&k);
p=(int**)malloc(k*sizeof(int*));
for(i=0;i<k;i++)
p[i]=(int*)malloc(5*sizeof(int));
for(i=0;i<k;i++)
for(j=0;j<5;j++)
scanf("%d",&p[i][j]);
for(i=0;i<k;i++)
{
count=0;
tem=p[i][0]-1;
if(hand[tem][0]!='\0'&&tem>=0)
{
sprintf(face,"%s",hand[tem]);
count+=strlen(hand[tem]);
}
else
{
printf("Are you kidding me? @\\/@\n");
continue;
}
tem=p[i][1]-1;
if(eye[tem][0]!='\0'&&tem>=0)
{
sprintf(face+count,"(%s",eye[tem]);
count=strlen(eye[tem])+count+1;
}
else
{
printf("Are you kidding me? @\\/@\n");
continue;
}
tem=p[i][2]-1;
if(month[tem][0]!='\0'&&tem>=0)
{
sprintf(face+count,"%s",month[tem]);
count+=strlen(month[tem]);
}
else
{
printf("Are you kidding me? @\\/@\n");
continue;
}
tem=p[i][3]-1;
if(eye[tem][0]!='\0'&&tem>=0)
{
sprintf(face+count,"%s)",eye[tem]);
count=strlen(eye[tem])+count+1;
}
else
{
printf("Are you kidding me? @\\/@\n");
continue;
}
tem=p[i][4]-1;
if(hand[tem][0]!='\0'&&tem>=0)
{
sprintf(face+count,"%s",hand[tem]);
count+=strlen(hand[tem]);
}
else
{
printf("Are you kidding me? @\\/@\n");
continue;
}
printf("%s\n",face);
}
return 0;
}