Algorithm Gao list time limit: 100ms memory limit: 8.0MBProblem description by zby ...:) Amoy got a list, he wanted to deal with the above name, pick out some special names, he asked you to help.
Amoy focus on the following names:
If the name is "Wys", he wants your program to output "KXZSMR".
If the name is "CQ", he wants your program to output "Chaiqiang".
If the name is "LC", he wants your program to output "Dragonnet".
If the name is "SYT" or "SSD" or "LSS" or "LYF", he wants your program to output "Studyfather".
If the name is not the same as any of the above names, he wants your program to output "denominator". Input format the first line has an integer n, which indicates the number of people on the list of Amoy.
Next n lines, each line has a string, that is, the name of the list. Output format output n rows, each row outputs the judging result of each person's name. Sample Input 9
Wys
CQ
Wys
LC
SYT
Ssds
LSS
LYF
Zby Sample Output KXZSMR
Chaiqiang
Kxzsmr
Dragonnet
Studyfather
Studyfather
Studyfather
Studyfather
Denominator data size and conventions for 50% data, N <= 1000, and names in the list may only be "Wys", "CQ", "LC" one of the three, no other name.
For 100% data, N <= 10000, a person's name consists only of uppercase letters, not exceeding 5 in length.
1#include <stdio.h>2#include <string.h>3 intMain ()4 {5 intN;6 Charname[Ten];7scanf"%d",&n);8 for(intI=0; i<n;i++)9 {Tenscanf"%s", name); One if(strcmp (Name,"Wys")==0) Aprintf"kxzsmr\n"); - - Else if(strcmp (Name,"CQ")==0) theprintf"chaiqiang\n"); - - Else if(strcmp (Name,"LC")==0) -printf"dragonnet\n"); + - Else if(strcmp (Name,"SYT")==0) +printf"studyfather\n"); A at Else if(strcmp (Name,"SSD")==0) -printf"studyfather\n"); - - Else if(strcmp (Name,"LSS")==0) -printf"studyfather\n"); - in Else if(strcmp (Name,"LYF")==0) -printf"studyfather\n"); to + Else -printf"denominator\n"); the * } $ return 0;Panax Notoginseng}
C language · List of Amoy