根據題目去對應輸入去輸出其語言為何,記得遇到不能對應的輸入要輸出UNKNOWN。
C++(0.003)
/*******************************************************/
/* UVa 12250 Language Detection */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2015/12/02 */
/*******************************************************/
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
string keys[] = { "HELLO",
"HOLA",
"HALLO",
"BONJOUR",
"CIAO",
"ZDRAVSTVUJTE" };
string values[] = { "ENGLISH",
"SPANISH",
"GERMAN",
"FRENCH",
"ITALIAN",
"RUSSIAN" };
int caseNumber = 0;
string S;
while( cin >> S && S != "#" ){
bool isFind = false;
for( int i = 0 ; i < 6 ; ++i ){
if( keys[i] == S ){
printf("Case %d: %s\n", ++caseNumber, values[i].c_str());
isFind = true;
break;
}
}
if( !isFind ){
printf("Case %d: UNKNOWN\n", ++caseNumber);
}
}
return 0;
}