CF1281A.Suffix Three
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a sentence is written in.
It's super simple, 100% accurate, and doesn't involve advanced machine learning algorithms.
Let us tell you how it works.
- If a sentence ends with "po" the language is Filipino.
- If a sentence ends with "desu" or "masu" the language is Japanese.
- If a sentence ends with "mnida" the language is Korean.
Given this, we need you to implement a suffix three that can differentiate Filipino, Japanese, and Korean.
Oh, did I say three suffixes? I meant four.
我们研究组刚刚发现了一种新的数据结构:后缀三元树(suffix three)!
它在自然语言处理中非常有用。给定三种语言和三个后缀,后缀三元树即可判断一个句子所使用的语言。
它的原理极其简单,准确率高达 100%,且不涉及任何复杂的机器学习算法。
下面为您介绍其工作原理:
- 若句子以
"po"结尾,则该句为菲律宾语(Filipino); - 若句子以
"desu"或"masu"结尾,则该句为日语(Japanese); - 若句子以
"mnida"结尾,则该句为韩语(Korean)。
基于以上规则,您需要实现一个后缀三元树,以区分菲律宾语、日语和韩语。
哦,刚才我说了三个后缀?其实应该是四个。
输入格式
The first line of input contains a single integer t (1≤t≤30) denoting the number of test cases. The next lines contain descriptions of the test cases.
Each test case consists of a single line containing a single string denoting the sentence. Spaces are represented as underscores (the symbol "_") for ease of reading. The sentence has at least 1 and at most 1000 characters, and consists only of lowercase English letters and underscores. The sentence has no leading or trailing underscores and no two consecutive underscores. It is guaranteed that the sentence ends with one of the four suffixes mentioned above.
输入的第一行包含一个整数 t(1≤t≤30),表示测试用例的数量。接下来的行包含各测试用例的描述。
每个测试用例由一行组成,该行包含一个字符串,表示一个句子。为便于阅读,空格用下划线(符号“_”)表示。该句子长度至少为 1,至多为 1000 个字符,且仅由小写英文字母和下划线组成。句子不以下划线开头或结尾,且不含两个连续的下划线。保证该句子以以上提到的四种后缀之一结尾。
输出格式
For each test case, print a single line containing either "FILIPINO", "JAPANESE", or "KOREAN" (all in uppercase, without quotes), depending on the detected language.
对于每个测试用例,输出一行,包含“FILIPINO”、“JAPANESE”或“KOREAN”(全部大写,不带引号),具体取决于所检测到的语言。
输入输出样例
输入#1
8 kamusta_po genki_desu ohayou_gozaimasu annyeong_hashimnida hajime_no_ippo bensamu_no_sentou_houhou_ga_okama_kenpo ang_halaman_doon_ay_sarisari_singkamasu si_roy_mustang_ay_namamasu
输出#1
FILIPINO JAPANESE JAPANESE KOREAN FILIPINO FILIPINO JAPANESE JAPANESE
说明/提示
The first sentence ends with "po", so it is written in Filipino.
The second and third sentences end with "desu" and "masu", so they are written in Japanese.
The fourth sentence ends with "mnida", so it is written in Korean.
第一句话以“po”结尾,因此是菲律宾语。
第二句和第三句分别以“desu”和“masu”结尾,因此是日语。
第四句话以“mnida”结尾,因此是韩语。
输入解题思路,AI测评打分。不知道怎么写?