Palindromes _easy version

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 47  Solved: 27
[Submit][Status][Web Board]

Description

“回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”。

Input

输入包含多个测试实例,输入数据的第一行是一个正整数n,表示测试实例的个数,后面紧跟着是n个字符串,每个字符串的长度不超过500。

Output

如果一个字符串是回文串,则输出"yes",否则输出"no".

Sample Input

4
level
abcde
noon
haha

Sample Output

yes
no
yes
no

HINT

 #include <iostream>
#include <stdio.h>
using namespace std; int main()
{
int n;
cin>>n;
getchar();
while(n--){
char s[];
cin.getline(s,,'\n');
int i,l;
for(l=;s[l]!='\0';l++);
for(i=;i<l;i++)
if(s[i]!=s[l-i-])
break;
if(i==l)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
return ;
}

Freecode : www.cnblogs.com/yym2013

ytu 1940:Palindromes _easy version(水题)的更多相关文章

  1. Palindromes _easy version

    Palindromes _easy version Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Jav ...

  2. Codeforces Round #599 (Div. 2) B1. Character Swap (Easy Version) 水题

    B1. Character Swap (Easy Version) This problem is different from the hard version. In this version U ...

  3. Codeforces Round #575 (Div. 3) D2. RGB Substring (hard version) 水题

    D2. RGB Substring (hard version) inputstandard input outputstandard output The only difference betwe ...

  4. ytu 1939:统计元音(水题)

    统计元音 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 68  Solved: 33[Submit][Status][Web Board] Descrip ...

  5. ytu 1910:字符统计(水题)

    字符统计 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 421  Solved: 92[Submit][Status][Web Board] Descri ...

  6. 武汉科技大学ACM :1004: 零起点学算法74——Palindromes _easy version

    Problem Description “回文串”是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串.请写一个程序判断读入的字符串是否是“回文”. Input 输入包含多 ...

  7. 杭电 2029 Palindromes _easy version

    Problem Description "回文串"是一个正读和反读都一样的字符串,比如"level"或者"noon"等等就是回文串.请写一个 ...

  8. HDU 2029 Palindromes _easy version

    http://acm.hdu.edu.cn/showproblem.php?pid=2029 Problem Description “回文串”是一个正读和反读都一样的字符串,比如“level”或者“ ...

  9. HDU2029:Palindromes _easy version

    Problem Description "回文串"是一个正读和反读都一样的字符串,比如"level"或者"noon"等等就是回文串.请写一个 ...

随机推荐

  1. xcrun: error: active developer path ("/Volumes/Xcode/Xcode-beta.app/Contents/Developer") does not exist, use `xcode-select --swi

    xcrun: error: active developer path ("/Volumes/Xcode/Xcode-beta.app/Contents/Developer") d ...

  2. 7、8上的cell上的一个按钮,当点击按钮时,要拿到这个cell,可以用代理,也可以用superview

    /** cell上的付款按钮事件 */ - (IBAction)paymentButtonClick:(UIButton *)sender { /** * @author SongXing, 15-0 ...

  3. Linux samba配置

    更详细的配置地址:http://www.cnblogs.com/mchina/archive/2012/12/18/2816717.html 1 安装  yum -y install samba 2 ...

  4. mysqldump命令介绍

    命令行下具体用法如下: mysqldump -u用戶名 -p密码 数据库名 表名 > 脚本名; 1.导出单个数据库的所有表的数据和结构 mysqldump -h localhost -uroot ...

  5. httpModules与httpHandlers之httpModules(转载)

    WapModule.cs:public class WapModule:IHttpModule{ public void Init(HttpApplication context)        {  ...

  6. SQL Server中的联合主键、聚集索引、非聚集索引、mysql 联合索引

    我们都知道在一个表中当需要2列以上才能确定记录的唯一性的时候,就需要用到联合主键,当建立联合主键以后,在查询数据的时候性能就会有很大的提升,不过并不是对联合主键的任何列单独查询的时候性能都会提升,但我 ...

  7. Android Broadcast Receiver 使用入门

    Broadcast Receiver 的使用        1.Broadcast Receiver简介        2.Broadcast Receiver接收系统自带的广播        3.自 ...

  8. [codeforces 509]C. Sums of Digits

    [codeforces 509]C. Sums of Digits 试题描述 Vasya had a strictly increasing sequence of positive integers ...

  9. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  10. DICOM:DICOM3.0网络通信协议(续)

    转载:http://blog.csdn.net/zssureqh/article/details/44278693 题记: 近一年来一直坚持周末写博客,整理工作和闲暇之余的点点滴滴.对于新知识点.新技 ...