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

 #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. World Finals 1996 Uva 247 (Floyd求闭包)

    思路:用Floyd求传递闭包. 附:逗号后的空格没看到,WA了好多次…….还有就是强连通分量也可以做,但是对这个题来说太麻烦,而且不方便输出,. 代码如下: #include<iostream& ...

  2. wordpress安装插件--su

     Add to Any: Subscribe Button 让读者方便的订阅你的博客到任何Feed阅读器 Google XML Sitemaps 生成完全兼容各大搜索引擎的Sitemaps/网站地图. ...

  3. Windows下python安装MySQLdb

    安装MySQLdb需要在电脑上安装MySQL connector C,只需要这个connector就好,不需要把mysql装全. 另外,需要安装VC for python提供编译. 到官网上下载脚本进 ...

  4. acm的第一场比赛的总结

    6.4-6.5号很激动的去湖南湘潭打了一场邀请赛,这是第一次acm的旅程吧.毕竟大一上册刚开始接触c,然后现在就能抱着学长的大腿(拖着学长的后腿)打比赛,也是有一点小小的激动. 第一天很早就起床了,由 ...

  5. Android手机fastboot刷机命令

    先进入fastboot文件所在目录 连接硬件命令 fastboot devices 删除recover.boot,system同理 Fastboot erase recovery 重刷,boot,sy ...

  6. Linux下find命令用法小结

    find是个使用频率比较高的命令.常常用它在系统特定目录下,查找具有某种特征的文件. find命令的格式:find [-path……] -options [-print -exec -ok] path ...

  7. MDK的优化应用(转)

    源:http://blog.163.com/zhaojun_xf/blog/static/300505802011291384721/ 使用Keil/MDK这么多年了,一直都没有使用它的代码优化功能. ...

  8. 关于自定义jar包(tomcat)的添加

    1 鼠标右击工程 选择 properties 或者 Ait + Enter 2 选择Libraries 3 点击Add Library... 4 选择User Library  点击 Next 5 如 ...

  9. ural1067 Disk Tree

    Disk Tree Time limit: 2.0 secondMemory limit: 64 MB Hacker Bill has accidentally lost all the inform ...

  10. OpenGL学习--------颜色的选择

    OpenGL支持两种颜色模式:一种是RGBA,一种是颜色索引模式.无论哪种颜色模式,计算机都必须为每一个像素保存一些数据.不同的是,RGBA模式中,数据直接就代表了颜色:而颜色索引模式中,数据代表的是 ...