UVA12250 LA4995 Language Detection【水题】

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 string S. You can assume that all the letters of the string are uppercase English letters and the maximum length of the string is 14. 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
HELLO
HOLA
HALLO
BONJOUR
CIAO
ZDRAVSTVUJTE

Sample Output
Case 1: ENGLISH
Case 2: SPANISH
Case 3: GERMAN
Case 4: FRENCH
Case 5: ITALIAN
Case 6: RUSSIAN

Regionals 2010 >> Asia - Kuala Lumpur

问题链接UVA12250 LA4995 Language Detection
问题简述:(略)
问题分析
    给定6个国家的问候语,求是哪个国家的问候语?
    简单题不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA12250 LA4995 Language Detection */

#include <bits/stdc++.h>

using namespace std;

const int N = 6;
string language[] = {
    "HELLO", "HOLA", "HALLO", "BONJOUR", "CIAO", "ZDRAVSTVUJTE"
};
string contry[] = {
        "ENGLISH", "SPANISH", "GERMAN", "FRENCH", "ITALIAN", "RUSSIAN", "UNKNOWN"
};
int main()
{
    int caseno = 0;
    string s;
    while(cin >> s && s != "#") {
        int i;
        for(i = 0; i < N; i++)
            if(s == language[i]) break;

        printf("Case %d: %s\n", ++caseno, contry[i].c_str());
    }

    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值