首页 > 其他 > 详细

Problem 2146 Easy Game (FZU 数学啊)

时间:2014-12-03 19:13:47      阅读:214      评论:0      收藏:0      [点我收藏+]

题目链接:http://acm.fzu.edu.cn/problem.php?pid=2146


Problem Description

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.

bubuko.com,布布扣 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

bubuko.com,布布扣 Output

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

bubuko.com,布布扣 Sample Input

4wellthisisthesimplestprobleminthiscontest

bubuko.com,布布扣 Sample Output

Case 1: EvenCase 2: OddCase 3: OddCase 4: Odd


代码如下:

#include <cstdio>
#include <cstring>
int main()
{
    char s[10087];
    int cas = 0;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%s",s);
        int len=strlen(s);
        printf("Case %d: ",++cas);
        if(len%2)
            printf("Odd\n");
        else
            printf("Even\n");
    }
    return 0;
}


Problem 2146 Easy Game (FZU 数学啊)

原文:http://blog.csdn.net/u012860063/article/details/41700669

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!