#4555: C++第9個測資點?


cj6503rmp4 (罪影)

學校 : 國防大學理工學院
編號 : 11839
來源 : [182.234.102.214]
最後登入時間 :
2013-10-24 23:19:00
a022. 迴文 | From: [140.132.34.93] | 發表日期 : 2010-11-16 08:24

#include <iostream>
using namespace std;
int main(){
           int max = 1000;
           char word[max];
           int p;
           while(cin.getline(word,max,'\n')){
                                             int i = strlen(word)/2;
                                             int j = i;
                                             for(i=i-1;i>=0;i--){
                                                                 if(word[i]==word[j]){
                                                                                      j++;
                                                                                      p = 1;}
                                                                 else{p = 0;                    
                                                                      break;}}
           if(p==1)
           cout << "yes" << endl;
           else
           cout << "no" << endl;}
           return 0;}                         
ZeroJudge Forum