武汉科技大学ACM :1005: 一二三

Problem Description

你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。他在纸上写了好些一二三,可惜有些字母写错了。已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?

Input

第一行为单词的个数(不超过10)。以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。

Output

对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。

Sample Input

3
owe
too
theee

Sample Output

1
2
3
 1 #include <stdio.h>
 2
 3 int main()
 4 {
 5     int cases;
 6     while(scanf("%d", &cases)!=EOF)
 7     {
 8         while( cases-- )
 9         {
10             char a[10];
11             scanf("%s", a);
12             int i=0;
13             while(a[i]!=‘\0‘)
14             {
15                 i++;
16             }
17
18             if( i > 3 ) puts("3");
19             else
20             {
21                 if( ( a[0] == ‘o‘ ) + ( a[1] == ‘n‘ ) + ( a[2] == ‘e‘ ) >= 2 )
22                     puts("1");
23                 else
24                     puts("2");
25             }
26         }
27     }
28
29
30     return 0;
31 }
				
时间: 2025-01-08 06:10:07

武汉科技大学ACM :1005: 一二三的相关文章

武汉科技大学ACM:1006: 我是老大

Problem Description 今年是2021年,正值武汉科技大学 ACM俱乐部成立10周年.十周年庆祝那天,从ACM俱乐部走出去的各路牛人欢聚一堂,其乐融融.庆祝晚会上,大家纷纷向俱乐部伸出援手,帮助俱乐部度过 经济难关(经费严重不足).其中就职于谷歌的BobLee.Facebook的YYD,自己创办ILOVEMCB公司的MCB,苹果的明爷,IBM的胖富 帅,微软的男神坐在一桌上.胖富帅说我捐a万美元,明爷说a万美元算什么我捐你的两倍,男神说我捐你们两和的4/5,YYD说你们太年轻了,

武汉科技大学ACM :1005: C语言程序设计教程(第三版)课后习题6.6

Problem Description 打印出所有"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该本身. 例如:153是一个水仙花数,因为153=1^3+5^3+3^3. Output: 153 ??? ??? ??? Input 无 Output 所有的水仙花数,从小的开始. 每行一个 Sample Input Sample Output 1 #include<stdio.h> 2 3 #include<math.h>

武汉科技大学ACM :1005: 零起点学算法101——手机短号

Problem Description 大家都知道,手机号是一个11位长的数字串,同时,作为学生,还可以申请加入校园网,如果加入成功,你将另外拥有一个短号.假设所有的短号都是是 6+手机号的后5位,比如号码为13512345678的手机,对应的短号就是645678. 现在,如果给你一个11位长的手机号码,你能找出对应的短号吗? Input 输入数据的第一行是一个N(N <= 200),表示有N个数据,接下来的N行每一行为一个11位的手机号码. Output 输出应包括N行,每行包括一个对应的短号

武汉科技大学ACM:1005: Soapbear and Honey

Problem Description Soapbear is the mascot of WHUACM team. Like other bears, Soapbear loves honey very much, so he decides to get some honeycombs for honey. There are N honeycombs hanging on some trees, numbered from 1 to N, and the height of honeyco

武汉科技大学ACM :1005: A+B for Input-Output Practice (V)

Problem Description Your task is to calculate the sum of some integers. Input Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. Output For each grou

武汉科技大学ACM :1001: A+B for Input-Output Practice (I)

Problem Description Your task is to Calculate a + b. Too easy?! Of course! I specially designed the problem for acm beginners.  You must have found that some problems have the same titles with this one, yes, all these problems were designed for the s

武汉科技大学ACM :1009: 华科版C语言程序设计教程(第二版)例题4.18

Problem Description 验证哥德巴赫猜想:任何充分大(>=4)的偶数都可以用两个素数之和表示. Input 输入一个偶数n.(2<n<=10000) Output 找到a.b使得 n=a+b 其中a.b为两个素数,且a<=b. Sample Input 4 100 Sample Output 2 2 3 97 1 #include <iostream> 2 3 #include<math.h> 4 5 using namespace std;

武汉科技大学ACM :1003: 零起点学算法14——三位数反转

Problem Description 水题 Input 输入1个3位数(题目包含多组测试数据) Output 分离该3位数的百位.十位和个位,反转后输出(每组测试数据一行) Sample Input 250 Sample Output 052 HINT 分离出各位数字可以用取余和除数 注意在C语言里,2个整数相乘除结果还是整数 比如8/3在C语言里结果是2 取余采用符号% 比如8%3的结果应该是2即8除以3后的余数 1 #include <stdio.h> 2 3 int main() 4

武汉科技大学ACM :1007: 华科版C语言程序设计教程(第二版)例题4.13

Problem Description 输入两个整数,求他们的最大公约数和最小公倍数. Input 两个整数. Output 最大公约数和最小公倍数. Sample Input 12 9 Sample Output 3 36 HINT 可以把求最小公约数和最小公倍数写成函数,方便以后调用. 1 #include <stdio.h> 2 3 void main() 4 5 { 6 7 int m,n; 8 9 while(scanf("%d%d",&m,&n)