#16497: C++解


henrytsui000 (霸氣@浩堂 今年17歲 文教被死當)


#include<bits/stdc++.h>
using namespace std;
int main(){
string st;
while(cin>>st){
int a=st.size(),key=1;
for(int i=0;i<a/2;i++)
if(st[i]!=st[a-i-1])key=0;
if(!key)cout<<"no"<<endl;
else cout<<"yes"<<endl;
}
return 0;
}

#16502: Re:C++解


ufve0704 (爬 我爬 我爬爬爬 有排行榜這種東西就是要爬 爬過我上面的那...)


我的解法:



#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv){
string a,d,e;
int b,c;
while(cin>>a){
b=a.length();
c=b;
if(b%2==1)
c--;
c=c/2;
d=a.substr(0,c);
e=a.substr(b-c);
reverse(e.begin(),e.end());
if(d==e)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
}