https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3710
判断输进来的字符串是1 2 3的英文,当然会有一点错误产生。
只要判一下这三个单词的特点即可
#include<bits/stdc++.h> using namespace std; int main(){ int n; double b; int ans[33]; scanf("%d",&n); while(n--) { memset(ans,0,sizeof(ans)); int res=0; char s[11]; cin>>s; if(strlen(s)==5) { cout<<"3"<<endl; } else{ if((s[0]=='o'&&s[1]=='n')||(s[0]=='o'&&s[2]=='e')||(s[1]=='n'&&s[2]=='e')) cout<<"1"<<endl; else cout<<"2"<<endl; } } return 0; }