题目大意:给一个字符串,判断是否回文(忽略大小写,忽略非字母字符)。

 #include <cstdio>
#include <cctype>
#include <cstring>
#define MAXN 100000 char str1[MAXN], str2[MAXN]; int main()
{
#ifdef LOCAL
freopen("in", "r", stdin);
#endif
while (gets(str1))
{
if (strcmp(str1, "DONE") == ) break;
int len1 = strlen(str1), len2 = ;
for (int i = ; i < len1; i++)
if (isalpha(str1[i]))
str2[len2++] = tolower(str1[i]);
bool palindrome = true;
for (int i = , j = len2-; i < j; i++, j--)
if (str2[i] != str2[j])
{
palindrome = false;
break;
}
if (palindrome) printf("You won't be eaten!\n");
else printf("Uh oh..\n");
}
return ;
}

  今天看《演算法笔记》的时候,无意中看到了Timus,就去刷了一道A+B,美其名曰:熟悉环境,有够无聊的了...^_^

UVa 10945 - Mother bear的更多相关文章

  1. UVA 12849 Mother’s Jam Puzzle( 高斯消元 )

    题目: http://uva.onlinejudge.org/external/128/12849.pdf #include <bits/stdc++.h> using namespace ...

  2. [zz] Pixar’s OpenSubdiv V2: A detailed look

    http://www.fxguide.com/featured/pixars-opensubdiv-v2-a-detailed-look/ Pixar’s OpenSubdiv V2: A detai ...

  3. [zz]The Royal Treatment

    http://www.cgw.com/Publications/CGW/2012/Volume-35-Issue-4-June-July-2012/The-Royal-Treatment.aspx T ...

  4. CodeForces - 907A Masha and Bears

    A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. Masha and Bears(翻译+思维)

    Description A family consisting of father bear, mother bear and son bear owns three cars. Father bea ...

  6. O - Masha and Bears

    Problem description A family consisting of father bear, mother bear and son bear owns three cars. Fa ...

  7. uva 10192 Vacation(最长公共子)

    uva 10192 Vacation The Problem You are planning to take some rest and to go out on vacation, but you ...

  8. 容斥原理--计算错排的方案数 UVA 10497

    错排问题是一种特殊的排列问题. 模型:把n个元素依次标上1,2,3.......n,求每一个元素都不在自己位置的排列数. 运用容斥原理,我们有两种解决方法: 1. 总的排列方法有A(n,n),即n!, ...

  9. Codeforces CF#628 Education 8 F. Bear and Fair Set

    F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

随机推荐

  1. springMVC简单的安全防御配置

    1,使用 spring form 标签 防 csrf 攻击 2,标明请求方法:RequestMethod.GET,RequestMethod.POST, PATCH, POST, PUT, and D ...

  2. Nginx配置proxy_pass【转载】

    在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走. 下面四种 ...

  3. 选择LDO的方法(转)

    http://www.micro-bridge.com/news/sort.asp?dy1=技术资料&dy2=产品相关资料&page=2 作者:LANDA PHAM   来源:德州仪器 ...

  4. plsql找外键约束关联的表的方法

    直接Ctrl + 鼠标左键 表名 就可以找到参照表(关联表)的名称 下面的是复杂的方法 这个就是关联的表 这里右键查看 可以查看到参照的表

  5. oracle有三个默认的用户名和密码,但是都无法登录的解决方法

    system/change_on_install, system/manager是较旧版的预设密码, 在安装较新版时会提示你设定密码, 若没有或忘了设定, 请参考以下重设: sqlplus / as ...

  6. TCP/IP Protocol Fundamentals Explained with a Diagram

    最近准备系统学习网络相关的知识,主要学习tcp/ip, websocket 知识. 原文地址:http://www.thegeekstuff.com/2011/11/tcp-ip-fundamenta ...

  7. regress_partition.sql

    --ENV --UAT @/test/change/env/env_test_uat.sql set echo on time on timing on set feedback on set pag ...

  8. .h .m切换

    快捷键是:command + control +[↑|↓]

  9. GridView 编辑,更新,删除 等操作~~

    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView1. ...

  10. HDU 4421 ZOJ 3656 Bit Magic

    2-SAT,不要所有位置全部建好边再判断,那样会MLE的. 正解是,每一位建好边,就进行一次2-SAT. #include<cstdio> #include<cstring> ...