UVa 12289 - One-Two-Three
2014-07-27 23:14
363 查看
题目:你有你哥弟弟,他会写one、two、three这3个单词,不过可能会写错一个字母,输出对应的数字。
分析:简单题。分别和3个单词比较,统计错误走个数,直接输出错误数不大于1的即可。
说明:uhunt终于好用了,O(∩_∩)O~
分析:简单题。分别和3个单词比较,统计错误走个数,直接输出错误数不大于1的即可。
说明:uhunt终于好用了,O(∩_∩)O~
#include <iostream> #include <cstdlib> using namespace std; char map[3][6] = {"one","two","three"}; char buf[6]; int main() { int n; while ( cin >> n ) while ( n -- ) { cin >> buf; for ( int i = 0 ; i < 3 ; ++ i ) { int count = 0; for ( int j = 0 ; buf[j] && map[i][j] ; ++ j ) count += (buf[j] != map[i][j]); if ( count <= 1 ) cout << i+1 << endl; } } return 0; }
相关文章推荐
- UVA 12289 One-Two-Three
- UVa 12289 One-Two-Three (water ver.)
- UVa 12289 - One-Two-Three
- 12289 - One-Two-Three
- UVA OJ 12289 One-Two-Three
- [结题报告]12289 - One-Two-Three Time limit: 1.000 seconds
- 12289 - One-Two-Three
- Uva 12889 One-Two-Three
- One-Two-Three (Uva)
- [解题报告]12289 - One-Two-Three
- UVa--12289 One-Two-Three
- 如何实现将'one,two,three,four,five' 分别打印
- One-Two-Three
- ChargeSystem——One,Two,Three
- queue by one stack、two stack and three stack
- 【ZT】少数派鲜活英语One,Two,Three...
- Project Euler17.数字1,2,3使用英文的表示为one,two,three,使用的英文的字母数的总和为3+3+5=11,现有1到1000,使用的英文字母数总和为多少?(空格和连接符不计)
- one two three zero six
- test one two three
- ChargeSystem——One,Two,Three