链接
分析:首先想到的就是map开string记录,才发现也记录不了带空格的,rnm!然后就着急┭┮﹏┭┮,我是fw,其实开二位字符串暴力即可
#include<stdio.h>
#include<string.h>
char s[100];
int n;
char a[12][100]= {"Little Gyro and Sort",
"Little Gyro and Sets",
"Little Gyro and Numbers",
"Little Gyro and Array",
"Little Gyro and Derrick",
"Little Gyro and Sequences",
"Disk Scheduling", "Monster Fighting",
"Logs Stacking", "Planet Connecting",
"Shuttle Bus", "Story of Eden"
};
char b[15][100]= {"Arithmetic Problems", "Birthday Gift",
"Pinch Pinch Pinch",
"Stay up Late and Wake up Early",
"No Breakfast for College Students",
"Robotics Innovation Lab",
"Mathematical Modelling Class",
"Words Interesting",
"Words Fascinating",
"Mobius Ring", "Grid Painting",
"Yet Another Bracket Sequence",
"Yet Another Stones Game",
"Yet Another Honoi Problem",
"Yet Another Infectious Virus"
};
char c[12][100]= {"Yin Mou", "Da Mo",
"Shu San", "Zu Zhuang",
"Xue Zhan", "Ying Jiu",
"Lian Meng", "Zhen Cha",
"Fan Gong", "Qi Cheng",
"Wei Xiu", "Jue Dou"
};
char d[14][100]= {"A Party for You Started",
"Broken Pad", "Cook Steak",
"Dessert Time", "Eat Grapes",
"Flag Scramble Competition",
"Goddess", "Happy Time is Always Short",
"Isolated Pointset", "Jiufeng's Football Team",
"Known-Well Palindrome Date - Easy Version",
"Known-Well Palindrome Date - Hard Version",
"Link Game of Prime Factors",
"Magic Cube Battle"
};
int main()
{
scanf("%d",&n);
getchar();
for(int i=0;i<n;i++)
{
memset(s,0,sizeof(s));
gets(s);
int f=0;
for(int j=0;j<12;j++)
{
if(strcmp(s,a[j])==0)
{
printf("2\n");
f=1;
break;
}
}
if(!f)
for(int j=0;j<15;j++)
{
if(strcmp(s,b[j])==0)
{
printf("3\n");
f=1;
break;
}
}
if(!f)
for(int j=0;j<12;j++)
{
if(strcmp(s,c[j])==0)
{
printf("4\n");
f=1;
break;
}
}
if(!f)
for(int j=0;j<14;j++)
{
if(strcmp(s,d[j])==0)
{
printf("17\n");
f=1;
break;
}
}
if(!f)
printf("-1\n");
}
}