Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
44665 惠子铭 判断字符串是否为回文 C++ Accepted 0 MS 256 KB 534 2024-03-31 23:41:20

Tests(4/4):


#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { char s[100]; int len,position; int i,j; gets(s);//获取字符串s len=strlen(s);//求字符串长度 i=0; j=len-1;//记录字符串首、尾位置 while( (i<j) &&(s[i]==s[j]) )//从首尾同时向中间判定,若不是回文串,则退出循环 { i++; j--; } if(i>=j) cout<<"yes"<<endl; else cout<<"no"<<endl; return 0; }


Judgement Protocol: