The Seventh Hunan Collegiate Programming Contest 一二三
来源:互联网 发布:linux 运行程序 编辑:程序博客网 时间:2024/05/18 22:39
[1103] 一二三
- 时间限制: 1000 ms 内存限制: 65535 K
- 问题描述
- 你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?
- 输入
- 第一行为单词的个数(不超过10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。
- 输出
- 对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。
- 样例输入
3owetootheee
- 样例输出
123
- 提示
无
- 来源
The Seventh Hunan Collegiate Programming Contest
水题一道,开始直接用的暴力搜索过的,后来改进了一下方法,直接水过
#include <cstdio>#include <cstring>using namespace std;int main(){ int t; char s[10]; scanf("%d",&t); while(t--) { scanf("%s",s); if(((s[0]>='a'&&s[0]<='z') && s[1]=='n' && s[2]=='e') ||(s[0]=='o' && (s[1]>='a'&&s[1]<='z') && s[2]=='e') ||(s[0]=='o' && s[1]=='n' && (s[2]>='a'&&s[2]<='z'))) printf("1\n"); else if(((s[0]>='a'&&s[0]<='z') && s[1]=='w' && s[2]=='o') ||(s[0]=='t' && (s[1]>='a'&&s[1]<='z') && s[2]=='o') ||(s[0]=='t' && s[1]=='w' && (s[2]>='a'&&s[2]<='z'))) printf("2\n"); else if(((s[0]>='a'&&s[0]<='z') && s[1]=='h' && s[2]=='r' && s[3]=='e' &&s[4]=='e') ||(s[0]=='t' && (s[1]>='a'&&s[1]<='z') && s[2]=='r' && s[3]=='e' &&s[4]=='e') ||(s[0]=='t' && s[1]=='h' && (s[2]>='a'&&s[2]<='z') && s[3]=='e' &&s[4]=='e') ||(s[0]=='t' && s[1]=='h' && s[2]=='r' && (s[3]>='a'&&s[3]<='z') &&s[4]=='e') ||(s[0]=='t' && s[1]=='h' && s[2]=='r' && s[3]=='e' &&(s[4]>='a'&&s[4]<='z'))) printf("3\n"); } return 0;}
#include <iostream>#include <cstring>using namespace std;int main(){ int t; char s[6]; cin>>t; while(t--) { cin>>s; if(strlen(s)==5)//利用长度的特点 cout<<"3\n"; else if(s[2]=='o'&&s[0]!='o') cout<<"2\n"; else if(s[2]!='o'&&s[0]=='t') cout<<"2\n"; else cout<<"1\n"; } return 0;}
1 0
- 一二三(The Seventh Hunan Collegiate Programming Contest)
- The Seventh Hunan Collegiate Programming Contest 一二三
- 盒子游戏(The Seventh Hunan Collegiate Programming Contest)
- The Seventh Hunan Collegiate Programming Contest 盒子游戏
- 【组队补题题】The Seventh Hunan Collegiate Programming Contest Semilive
- 湖南省第六届大学生计算机程序设计竞赛 The Sixth Hunan Collegiate Programming Contest 主办:湖南省教育厅 协办:湖南省高
- #The 9th Hunan Collegiate Programming Contest#B.Boxes in a Line,双向链表的操作。。。
- The 2013 Arab Collegiate Programming Contest 题解
- The 2012 8th Hunan University Programming Contest 水题
- 数字猜想-Hunan University 2008 the 4th Programming Contest
- Galactic Collegiate Programming Contest
- The 2015 China Collegiate Programming Contest D Pick The Sticks
- The 31st ACM International Collegiate Programming Contest World Finals
- The 7th Zhejiang Provincial Collegiate Programming Contest
- The 6th Zhejiang Provincial Collegiate Programming Contest
- The 8th Zhejiang Provincial Collegiate Programming Contest / L - Javabeans
- The 8th Zhejiang Provincial Collegiate Programming Contest / M - Median
- The 8th Zhejiang Provincial Collegiate Programming Contest
- json解析:[2]fastjson 使用
- UVA 10088 Trees on My Island(求整顶点多边形内部整点数)
- cookie 与 session深入学习
- 【电脑使用技巧】回收站文件恢复
- svn插件中解决代码冲突
- The Seventh Hunan Collegiate Programming Contest 一二三
- VB.NET版机房重构之存储过程+事务实现注册
- YII 验证码与session前缀的修改
- 【Python Challenge-10】bull
- Don't get a business degree, get angry
- (转载)AppiumDriver类架构
- C++读取文件夹中所有的文件或者是特定后缀的文件
- linux下的daemon进程
- 幼儿园监控到底什么牌子好