A Easy Game(FZU 2146)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chimchim04/article/details/78633821

             A Easy Game

比赛题目链接大笑大笑大笑

Fat brother and Maze are playing a kind of special (hentai) game on a string S. Now they would like to count the length of this string. But as both Fat brother and Maze are programmers, they can recognize only two numbers 0 and 1. So instead of judging the length of this string, they decide to judge weather this number is even.

Input

The first line of the date is an integer T, which is the number of the text cases.

Then T cases follow, each case contains a line describe the string S in the treasure map. Not that S only contains lower case letters.

1 <= T <= 100, the length of the string is less than 10086

Output

For each case, output the case number first, and then output “Odd” if the length of S is odd, otherwise just output “Even”.

Sample Input
4
well
thisisthesimplest
problem
inthiscontest
Sample Output
Case 1: Even
Case 2: Odd
Case 3: Odd
Case 4: Odd



题目的大概意思是字符串中的字符个数如果是偶数输出"Even",是奇数输出“Odd”。
由于题目比较简单我就不写解析了。。。
代码如下:
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
    int t,n=1;
    scanf("%d",&t);
    while(t--)
    {
        char a[10100];
        scanf("%s",a);
        printf("Case %d: ",n++);
        int len=strlen(a);
        if(len%2==1)
            printf("Odd\n");
        else
            printf("Even\n");
    }
    return 0;
}

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页