UVa 12250 Language Detection (water ver.)

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

本文URL地址:http://www.bianceng.cn/Programming/sjjg/201410/45520.htm

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.

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;
}

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索string
, case
, line
, Hello
, The
language
language detection、12250、12250什么意思、detection、format detection,以便于您获取更多的相关知识。

时间: 2024-08-07 18:03:14

UVa 12250 Language Detection (water ver.)的相关文章

UVa 11727 Cost Cutting (water ver.)

11727 - Cost Cutting Time limit: 1.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2827 Company XYZ have been badly hit by recession and is taking a lot of cost cutting

UVa 10300 Ecological Premium (water ver.)

10300 - Ecological PremiumTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=1241 German farmers are given a premium depending on the conditions at their far

UVa 488 Triangle Wave (water ver.)

488 - Triangle Wave Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=429 In this problem you are to generate a triangular wave form according to a specifie

UVa 10783 Odd Sum (water ver.)

10783 - Odd Sum Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=19&page=show_problem&problem=1724 Given a range [a, b], you are to find the summation of all the odd integers in this r

UVa 272 TEX Quotes (water ver.)

272 - TEX Quotes Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=208 TeX is a typesetting language developed by Donald Knuth. It takes source text togethe

UVa 10079 Pizza Cutting (water ver.)

10079 - Pizza Cutting Time limit: 8.333 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1020 When someone calls Ivan lazy, he claims that it is his intelligence that helps

UVa 11332 Summing Digits (water ver.)

11332 - Summing Digits Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2307 For a positive integer n, let f(n) denote the sum of the digits of n when repr

UVa 10252 Common Permutation (water ver.)

10252 - Common Permutation Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1193 Given two strings of lowercase letters, a and b, print the longest string

UVa 371 Ackermann Functions (water ver.)

371 - Ackermann Functions Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=307 An Ackermann function has the characteristic that the length of the sequence