Easy Game

来源:互联网 发布:淘宝该版本不支持授权 编辑:程序博客网 时间:2024/05/18 00:26

查看 提交 统计 提问
总时间限制: 1000ms 内存限制: 32768kB
描述
Fat brother(胖哥) and Maze(梅兹) are playing a kindof special 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 whether this number is even(偶数).


输入
The first line of the data 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. Now that S only contains lower case letters.
1 <= T <= 100, the length of the string is less than 10086
输出
For each case, output the case number first, and then output “Odd” 
if the length of S is odd, otherwise just output “Even”.
样例输入
4
Well
Thisisthesimplest
problem 
inthiscontest
样例输出
Case 1: Even
Case 2: Odd 
Case 3: Odd 
Case 4: Odd
来源

第四届福建省大学生程序设计竞赛



#include<iostream>#include<stdio.h>#include<string.h>using namespace std;char a[20000];int main(){int nc;cin >> nc;for(int i = 0 ; i < nc ; i++){scanf("%s",a);cout << "Case " << i + 1 << ": ";if(strlen(a)%2)cout<<"Odd"<<endl;elsecout<<"Even"<<endl;}return 0;}



0 0
原创粉丝点击