回文串判定
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
输入一串字符(长度小于100),判断该串字符是否是回文串(正序读与逆序读内容相同)。
Input
Output
若该串字符是回文串输出“yes",否则输出”no“。
Example Input
Example Output
Hint
Author
Tue Dec 26 2017 22:47:46 GMT+0800 (中国标准时间)
Copyright © 2013-2017 SDUTACM Team. All Rights Reserved.
#include <stdio.h>
#include <string.h>
int main ()
{
char s[16]={'a'} ,a[16]={'a'};
gets(s);
int i,n;
n = strlen(s);
int j = 0;
i = n-1;
for (j = 0 ; j < n;j++)
{
a[j] = s[i];
i--;
}
if (strcmp(s , a)==0)
{
printf("yes\n");
}
else printf("no\n");
return 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)