• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Uva 12289 - One-Two-Three

你为何这么叼!

 One-Two-Three 

 Time limit: 1.000 seconds

 

Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize them. Note that your little brother is only a child, so he may make small mistakes: for each word, there might be at most one wrong letter. The word length is always correct. It is guaranteed that each letter he wrote is in lower-case, and each word he wrote has a unique interpretation.

Input 

The first line contains the number of words that your little brother has written. Each of the following lines contains a single word with all letters in lower-case. The words satisfy the constraints above: at most one letter might be wrong, but the word length is always correct. There will be at most 10 words in the input.

Output 

For each test case, print the numerical value of the word.

Sample Input 

3
owe
too
theee

Sample Output 

1
2
3

 


The Seventh Hunan Collegiate Programming Contest
Problemsetter: Rujia Liu, Special Thanks: Yiming Li & Jane Alam Jan

 

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 using namespace std;
 5 int n,m;
 6 char s[1001];
 7 int main(){
 8     int t;
 9     scanf("%d",&t);
10     while(t--){
11         scanf("%s",s);
12         int k1=0,k2=0,k3=0;
13         if(s[0]=='o')k1++;if(s[1]=='n')k1++;if(s[2]=='e')k1++;
14         if(s[0]=='t')k2++;if(s[1]=='w')k2++;if(s[2]=='o')k2++;
15         if(s[0]=='t')k3++;if(s[1]=='h')k3++;if(s[2]=='r')k3++;
16         if(k1>=2)printf("1\n");
17         if(k2>=2)printf("2\n");
18         if(k3>=2)printf("3\n");
19     }
20     return 0;
21 }
View Code 2013-10-10 00:49:16 

 

posted @ 2013-10-10 00:51  HaibaraAi  阅读(122)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3