1167:0 start-up algorithm 74--palindromes _easy version time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:1754 accepted:1023
[Submit] [Status] [Web Board] Description
"Palindrome string" is a literal reading and anti-read all the same string, such as "level" or "noon" and so on is a palindrome string. Please write a program to determine whether the read-in string is a "palindrome".
Input
The input contains multiple test instances, the first line of the input data is a positive integer n, which indicates the number of test instances followed by n strings. Each string length does not exceed 150.
Output
If a string is a palindrome, output "yes", otherwise output "no".
Sample Input
4levelabcdenoonhaha
Sample Output
Yesnoyesno
Source
0 Starting point Learning algorithm
1#include <stdio.h>2#include <string.h>3 intMain () {4 intN;5 Chara[ Max];6scanf"%d%*c",&n);7 while(n--){8 gets (a);9 intl,p=1;TenL=strlen (a); One for(intI=0;i< (L +1)/2; i++){ A if(a[i]!=a[l-1-i]) p=0; - } -Puts (p?"Yes":"No"); the } - return 0; -}
1167:0 starting point Learning algorithm 74--palindromes _easy version