题解:B3759 [信息与未来 2021] 文本分类

· · 题解

这题什么时候又能写题解了

大意

应该是个人都能看懂,给你 T 个句子,要么全是拼音,要么全是英语单词,判断每一句中文句子还是英语句子。

思路

判断有没有词语包含 th 即可,拼音中没有这个读音。

代码

#include<iostream>
#include<string>
using namespace std;
int main()
{
    int T;
    cin>>T;
    while(T--){
        int n,flag=1;
        cin>>n;
        while(n--){
            string s;
            cin>>s;
            if(s.find("th")!=string::npos) flag=0;
        }
        if(flag) cout<<"Pinyin\n";
        else cout<<"English\n";
    }
    return 0;
}