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

· · 题解

English.

让我们挖掘直觉。

拼音中没有 th,但英语中却很常见,如 th these 等。

直接判断即可。

代码:

使用了 getline 和 find 函数,代码极短。

#include<bits/stdc++.h>
using namespace std;
int t,n;
string s;
int main(){
    cin>>t;
    while(t--){
        cin>>n;
        getline(cin,s);
        if(int(s.find("th"))!=-1) cout<<"English\n";
        else cout<<"Pinyin\n";
    }
    return 0;
}