UVa 10945 - Mother bear
题目大意:给一个字符串,判断是否回文(忽略大小写,忽略非字母字符)。
#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的更多相关文章
- UVA 12849 Mother’s Jam Puzzle( 高斯消元 )
题目: http://uva.onlinejudge.org/external/128/12849.pdf #include <bits/stdc++.h> using namespace ...
- [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 ...
- [zz]The Royal Treatment
http://www.cgw.com/Publications/CGW/2012/Volume-35-Issue-4-June-July-2012/The-Royal-Treatment.aspx T ...
- CodeForces - 907A Masha and Bears
A. Masha and Bears time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Masha and Bears(翻译+思维)
Description A family consisting of father bear, mother bear and son bear owns three cars. Father bea ...
- O - Masha and Bears
Problem description A family consisting of father bear, mother bear and son bear owns three cars. Fa ...
- uva 10192 Vacation(最长公共子)
uva 10192 Vacation The Problem You are planning to take some rest and to go out on vacation, but you ...
- 容斥原理--计算错排的方案数 UVA 10497
错排问题是一种特殊的排列问题. 模型:把n个元素依次标上1,2,3.......n,求每一个元素都不在自己位置的排列数. 运用容斥原理,我们有两种解决方法: 1. 总的排列方法有A(n,n),即n!, ...
- 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 ...
随机推荐
- 转:透析QTP自动化测试框架SAFFRON
1.为什么要使用框架? 框架是一组自动化测试的规范.测试脚本的基础代码,以及测试思想.惯例的集合.可用于减少冗余代码.提高代码生产率.提高代码重用性和可维护性.例如QTestWare就是QTP自动化测 ...
- Git 使用初体验
http://my.oschina.net/moooofly/blog/228608 很久之前在 http://git.oschina.net/ 上创建了一个私有项目 modb ,目的主要是用来学习如 ...
- Servlet程序开发--实例操作:MVC设计模式应用
以前做过一个登录程序,是用JSP+JavaBean完成的,最大的问题,JSP文件内容太多了. 1. VO 2. DBC 3. DAO 3.1 impl 3.2 proxy 4. Factory 5. ...
- filters
http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/admin_hbase_filtering.h ...
- 阿里云CentOS安装firefox闪退
安装完vnc远程连接,接着安装firefox,点firefox木有任何提示就退 直接命令下运行,发现错误如下: /usr/lib/firefox/firefox: symbol lookup erro ...
- Android之EditText控件
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content&q ...
- UVA 10304 Optimal Binary Search Tree
简单区间DP. #include<cstdio> #include<cstring> #include<cmath> #include<vector> ...
- CodeForces 591A Wizards' Duel
水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...
- boost锁的使用
boost锁的概述 boost库中提供了mutex类与lock类,通过组合可以轻易的构建读写锁与互斥锁. ▲ mutex对象类 mutex类提供互斥量,主要有两种:boost::mutex,b ...
- Linux的iptables常用配置范例(2)
iptables -F #清除所有规则 iptables -X #清除所有自定义规则 iptables -Z #各项计数归零 iptables -P INPUT DROP #将input链 ...