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. python 入门

    bool t, f = True, False print type(t) # Prints "<type 'bool'>"   字符串 hello = 'hello' ...

  2. ftp (文件传输协议)

    ftp (文件传输协议) 锁定 本词条由“科普中国”百科科学词条编写与应用工作项目 审核 . FTP 是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为“文传协议” ...

  3. 我的前端MVC之路

    大约十几个月前,了解到时下前端MVC之火爆,同事推荐我了解一下angular.当时也不是特别在意,只是稍稍阅读了一遍官方文档,并尝试了文档上的例子.其实当时也颇有震惊之感的,原来代码还可以这么写!看完 ...

  4. 键盘上各键对应的ASCII码与扫描码

    键盘上各键对应的ASCII码与扫描码 vbKeyLButton 0x1 鼠标左键vbKeyRButton 0x2 鼠标右键vbKeyCancel 0x3 CANCEL 键vbKeyMButton 0x ...

  5. 字符串模拟赛T1

    // source code from laekov for c0x17 #define PRID "bxjl" #include <cstdio> #include ...

  6. editplus快捷键大全之editplus搜索快捷键

    前面我们说了editplus快捷键大全之editplus文件快捷键和editplus快捷键大全之editplus光标快捷键,editplus快捷键大全之editplus编辑快捷键这里我们讲一下edit ...

  7. Who Gets the Most Candies?(线段树 + 反素数 )

    Who Gets the Most Candies? Time Limit:5000MS     Memory Limit:131072KB     64bit IO Format:%I64d &am ...

  8. 测试Swift语言代码高亮-使用highlight.js

    func &( left:OCBool, right: OCBool)->OCBool{ if left{ return right } else{ return false } }

  9. Linux 4.6分支已到生命尽头 请尽快升级至Linux 4.7.1

    导读 在Linux Kernel 4.7首个维护版本发布的同时,Greg Kroah-Hartman同时也向社区发布了Linux Kernel 4.6.7版本.作为Linux 4.6分支的第7个维护版 ...

  10. Unity3d 去掉exe版本的边框

    原地址:http://blog.sina.com.cn/s/blog_697b1b8c0101gd4h.html using System; using System.Runtime.InteropS ...