文章

1

粉丝

20

获赞

0

访问

126

头像
回文字符串 题解:C++ 指针
P1414 华中科技大学/东南大学2016年机试题
发布于2024年3月26日 01:32
阅读数 126

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int main(){
    char s1[1005];
    while(scanf("%s",s1)!=EOF){
       char *p=s1;
       char *q=s1+strlen(s1)-1;

       int flag=0;
       while(*p!='\0'){
           if(*p != *q){
               flag=1;
               break;
           }else{
               p++;
               q--;
           }
       }
       if(flag==0)
           cout<<"Yes!"<<endl;
       else
      &n...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发