zoukankan      html  css  js  c++  java
  • csu 1100 一二三(水)

    A - 一二三
    Time Limit:1000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64u
    Submit

    Status
    Description
    你弟弟刚刚学会写英语的一(one)、二(two)和三(three)。
    他在纸上写了好些一二三,可惜有些字母写错了。
    已知每个单词最多有一个字母写错了(单词长度肯定不会错),你能认出他写的啥吗?
    Input
    第一行为单词的个数(不超过10)。
    以下每行为一个单词,单词长度正确,且最多有一个字母写错。所有字母都是小写的。
    Output
    对于每组测试数据,输出一行,即该单词的阿拉伯数字。输入保证只有一种理解方式。
    Sample Input
    3
    owe
    too
    theee
    Sample Output
    1
    2
    3

    超水题= =


    #include<stdio.h>
    #include<string.h>
    #include<math.h>
    #include<iostream>
    #include<algorithm>
    #include<queue>
    #include<stack>
    #define mem(a,b) memset(a,b,sizeof(a))
    #define ll __int64
    #define MAXN 1000
    #define INF 0x7ffffff
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    using namespace std;
    char word[100];
    char one[5]={'o','n','e'};
    char two[5]={'t','w','o'};
    int main()
    {
    int t,i,j;
    scanf("%d%*c",&t);
    while(t--)
    {
    mem(word,0);
    scanf("%s",word);
    int len=strlen(word);

    if(len==5)
    {
    printf("3 ");
    }
    else
    {
    int c1=0,c2=0;
    for(i=0;i<3;i++)
    {
    if(word[i]==one[i]) c1++;
    if(word[i]==two[i]) c2++;
    }
    if(c1>=2) cout<<"1 ";
    else if(c2>=2) cout<<"2 ";
    }
    }
    return 0;
    }

  • 相关阅读:
    UVa532 Dungeon Master 三维迷宫
    6.4.2 走迷宫
    UVA 439 Knight Moves
    UVa784 Maze Exploration
    UVa657 The die is cast
    UVa572 Oil Deposits DFS求连通块
    UVa10562 Undraw the Trees
    UVa839 Not so Mobile
    327
    UVa699 The Falling Leaves
  • 原文地址:https://www.cnblogs.com/sola1994/p/3915910.html
Copyright © 2011-2022 走看看