fzu 2146 Easy Game

时间:2023-03-08 16:58:48
fzu 2146 Easy Game

http://acm.fzu.edu.cn/problem.php?pid=2146

fzu 2146 Easy Game Problem 2146 Easy Game

Accept: 661    Submit: 915
Time Limit: 1000 mSec    Memory Limit : 32768 KB

fzu 2146 Easy Game 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.

fzu 2146 Easy Game 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

fzu 2146 Easy Game Output

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

fzu 2146 Easy Game Sample Input

4
well
thisisthesimplest
problem
inthiscontest

fzu 2146 Easy Game Sample Output

Case 1: Even
Case 2: Odd
Case 3: Odd
Case 4: Odd
分析:
就是字符串数组长度奇偶判断,一个strlen()函数解决。
AC代码:
 #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0);
char str[MAX]; int main()
{
int T ;
while(~scanf("%d",&T))
{
int first = ;
getchar();
while(T --)
{
scanf("%s",str);
int len = strlen(str);
printf("Case %d: ", first ++);
if(len % )
printf("Odd\n");
else
printf("Even\n");
}
}
return ;
}