UVa 12289 One-Two-Three (water ver.)

12289 - One-Two-Three

Time limit: 1.000 seconds

http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&category=244&page=show_problem&problem=3710

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

这居然还是lrj出的题。。

完整代码:

/*0.016s*/

#include<cstdio>
#include<cstring>
const char one[] = "one";

char s[10];

int main()
{
    int t, i, c;
    scanf("%d\n", &t);
    while (t--)
    {
        gets(s);
        if (strlen(s) == 5) puts("3");
        else
        {
            c = 0;
            for (i = 0; i < 3; ++i) if (s[i] == one[i]) ++c;
            puts(c > 1 ? "1" : "2");
        }
    }
    return 0;
}

作者:csdn博客 synapse7

查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索word
, each
, 蓝牙 lot in he and
, words
, The
One
threewatermiao、three.js water、www.12289.com、12289.com、12289,以便于您获取更多的相关知识。

时间: 2024-10-25 14:28:37

UVa 12289 One-Two-Three (water ver.)的相关文章

UVa 10656 Maximum Sum (II) (water ver.)

10656 - Maximum Sum (II) Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1597 In a given a sequence of non-negative integers you will have to find such a

UVa 12640 Largest Sum Game (water ver.)

12640 - Largest Sum Game Time limit: 1.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=602&page=show_problem&problem=4388 题目:http://uva.onlinejudge.org/external/126/12640.pdf 主要是读取数据怎么处理. 完整代码: /*0

UVa 10921 Find the Telephone (water ver.)

10921 - Find the Telephone Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1862 In some places is common to remember a phone number associating its digits

UVa 10019 Funny Encryption Method (water ver.)

10019 - Funny Encryption Method Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=960 The Problem History : A student from ITESM Campus Monterrey plays with

UVa 10346 Peter&#039;s Smokes (water ver.)

10346 - Peter's Smokes Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1287 Peter has n cigarettes. He smokes them one by one keeping all the butts. Out o

UVa 11498 Division of Nlogonia (water ver.)

11498 - Division of Nlogonia Time limit: 1.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2493 The Problem After centuries of hostilities and skirmishes between the fo

UVa 457 Linear Cellular Automata (water ver.)

457 - Linear Cellular Automata Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=398 A biologist is experimenting with DNA modification of bacterial colonie

UVa 11044 Searching for Nessy (water ver.)

11044 - Searching for Nessy Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=1985 The Loch Ness Monsteris a mysterious and unidentified animal said to inha

UVa 102 Ecological Bin Packing (water ver.)

102 - Ecological Bin Packing Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=38 Background Bin packing, or the placement of objects of certain weights int

UVa 10008 What&#039;s Cryptanalysis? (water ver.)

10008 - What's Cryptanalysis? Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=949 Cryptanalysis is the process of breaking someone else's cryptographic wr