UVa 12250 Language Detection (water ver.)
来源:互联网 发布:爱德华大夫观后感 知乎 编辑:程序博客网 时间:2024/06/03 18:27
12250 - Language Detection
Time limit: 3.000 seconds
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3402
English, Spanish, German, French, Italian and Russian are the 6 most prominent languages in the countries of European Union. Figure on the left shows intensity of English speaking people in different European countries. All of these languages have different words to represent the English word “HELLO”. For example in Spanish the word equivalent to “HELLO” is “HOLA”. In German, French, Italian and Russian language the word that means (or similar to) “HELLO” is “HALLO”, “BONJOUR”, “CIAO” and “ZDRAVSTVUJTE” respectively.
In this problem your task is pretty simple. You will be given one of the six words mentioned above or any other word and you will have to try and detect the language it is from.
Input
Input file contains around 2000 lines of inputs. Each line contains a stringS. You can assume that all the letters of the string are uppercase English letters and the maximum length of the string is14. Input is terminated by a line containing a single ‘#’ character (without the quote). This line should not be processed.
Output
For each line of input except the last one produce one line of output.
This line contains the serial of output followed by a language name. If the input string is“HELLO” or “HOLA” or “HALLO” or“BONJOUR” or “CIAO” or “ZDRAVSTVUJTE” then you should report the language it belongs to. If the input string is something other than these 6 strings print the string“UNKNOWN” (without the quotes) instead. All characters in the output strings are uppercase as well. Look at the output for sample input for formatting details.
Sample Input Output for Sample Input
HELLO
HOLA
HALLO
BONJOUR
CIAO
ZDRAVSTVUJTE
#
Case 1: ENGLISH
Case 2: SPANISH
Case 3: GERMAN
Case 4: FRENCH
Case 5: ITALIAN
Case 6: RUSSIAN
/*0.009s*/#include<cstdio>#include<cstring>const char* hello[6] = {"HELLO", "HOLA", "HALLO", "BONJOUR", "CIAO", "ZDRAVSTVUJTE"};const char* country[7] = {"ENGLISH", "SPANISH", "GERMAN", "FRENCH", "ITALIAN", "RUSSIAN", "UNKNOWN"};char str[20];int main(){int cas = 0, i;while (gets(str), str[0] != '#'){printf("Case %d: ", ++cas);for (i = 0; i < 6; ++i)if (strcmp(str, hello[i]) == 0){puts(country[i]);break;}if (i == 6) puts(country[i]);}return 0;}
- UVa 12250 Language Detection (water ver.)
- UVa 12250 - Language Detection
- UVa 10082 WERTYU (water ver.)
- UVa 10696 f91 (water ver.)
- UVa 79 ClockHands (water ver.)
- UVa 11340 Newspaper (water ver.)
- UVa 514 Rails (water ver.)
- UVa 11150 Cola (water ver.)
- UVa 10300 Ecological Premium (water ver.)
- UVa 414 Machined Surfaces (water ver.)
- UVa 490 Rotating Sentences (water ver.)
- UVa 445 Marvelous Mazes (water ver.)
- UVa 488 Triangle Wave (water ver.)
- UVa 10783 Odd Sum (water ver.)
- UVa 457 Linear Cellular Automata (water ver.)
- UVa 621 Secret Research (water ver.)
- UVa 11044 Searching for Nessy (water ver.)
- UVa 102 Ecological Bin Packing (water ver.)
- Floyd求最短路+输出路径上节点
- juniper SSG路由对个别用户(组)限速配置
- duilib做的一个程序
- 我对VC维的理解
- KVM虚拟机三大存储模式
- UVa 12250 Language Detection (water ver.)
- 将Vim改造为强大的IDE—Vim集成Ctags/Taglist/Cscope/Winmanager/NERDTree/OmniCppComplete(有图有真相)
- linux-android搭建
- 《Effective c++目录概要》——提升代码设计的55个忠告(32~55)
- 黑马程序员-集合框架之Collection
- HDU 4127 Flood-it! (迭代加深搜索)
- aChartEngine制作双y轴(barChart+TimeChart)图表(x轴为日期/时间)
- opencv学习
- word 2007 自动恢复文档