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

 Problem 2146 Easy Game

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

 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.

 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
 
分析:
就是字符串数组长度奇偶判断,一个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 ;
}
 

fzu 2146 Easy Game的更多相关文章

  1. FZU 2146

    Easy Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit St ...

  2. fzu 1913 Easy Comparison(字符串)

    题目链接:fzu 1913 Easy Comparison 题目大意:给出一个字符串,计算与它按照字典序排序排列后的字符串有多少个位置不同. 解题思路:水体,sort一下,然后遍历一遍就好. #inc ...

  3. FZU 2176 easy problem (DFS序+树状数组)

    对于一颗树,dfs遍历为每个节点标号,在进入一个树是标号和在遍历完这个树的子树后标号,那么子树所有的标号都在这两个数之间,是一个连续的区间.(好神奇~~~) 这样每次操作一个结点的子树时,在每个点的开 ...

  4. fzu 1753 Another Easy Problem

    本题题意为求 t (t<150) 个 c (n,m)  (1<=m<=n<=100000)的最大公因子: 本题的难点为优化.主要有两个优化重点.一是每次对单个素因子进行处理,优 ...

  5. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  6. FZU 2105 Digits Count(位数计算)

    Description 题目描述 Given N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations: Operation ...

  7. fzu 2105 Digits Count ( 线段树 ) from 第三届福建省大学生程序设计竞赛

    http://acm.fzu.edu.cn/problem.php?pid=2105 Problem Description Given N integers A={A[0],A[1],...,A[N ...

  8. FZU 2108(dfs模拟,大数取余)

     K Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Pr ...

  9. FZU Monthly-201903 tutorial

    FZU Monthly-201903 tutorial 题目(难度递增) easy easy-medium medium medium-hard hard 思维难度 ABF G CH D E A. D ...

随机推荐

  1. Demonstrating One-Shot Execution TimerTask Timer

    Listing -. Demonstrating One-Shot Execution import java.util.Timer; import java.util.TimerTask; publ ...

  2. TOMCAT源码分析(启动框架)

    建议: 毕竟TOMCAT的框架还是比较复杂的, 单是从文字上理解, 是不那么容易掌握TOMCAT的框架的. 所以得实践.实践.再实践. 建议下载一份TOMCAT的源码, 调试通过, 然后单步跟踪其启动 ...

  3. awk统计nginx日志访问前一百的ip

    访问ip  awk '{print $1}' access.log| sort | uniq -c | sort -n -k 1 -r | head -n 100 访问地址 awk '{print $ ...

  4. PushKit和传统长连接方式的比较

    iOS and PushKit This post will cover basic concepts for VoIP apps on iOS. I will not post any code ( ...

  5. android 资源ID

    在编译的时候,AAPT会扫描你所定义的所有资源(在不同文件中定义的以及单独的资源文件),然后给它们指定不同的资源ID.资源ID 是一个32bit的数字,格式是PPTTNNNN , PP代表资源所属的包 ...

  6. Javascript实现提示错误的信息直接出现在输入框后

    可以在输入框后加个<span id="error"></span>,当验证错误时这样处理document.getElementById('error').i ...

  7. 完美解决 .txt文件在Mac上不能打开的问题

  8. Mac版 MicrosoftOffice2015 办公软件 破解教程

    来自:http://bbs.feng.com/read-htm-tid-9704285.html 下载链接:http://pan.baidu.com/s/1dD6lBFz  提取密码:xu5n 补丁: ...

  9. 将一个UIView对象的内容保存为UIImage

    + (UIImage*)imageFromView:(UIView*)view{ UIGraphicsBeginImageContextWithOptions(view.bounds.size, YE ...

  10. LintCode A + B Problem

    原题链接在这里:http://www.lintcode.com/en/problem/a-b-problem/ 不让用 数学运算符,就用位运算符. a的对应位 ^ b的对应位 ^ carry 就是re ...