2016年11月5日 星期六

TIOJ 1660 - 迴文判斷

http://tioj.infor.org/problems/1660

裸裸水水的



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<bits/stdc++.h>
using namespace std;

string s;
int i;
bool jizz;
int main(){
    ios_base::sync_with_stdio(0);
    while(cin>>s){
        for(i=0;i<(int)s.length()/2;i++){
            if(s[i]!=s[s.length()-1-i]){
                jizz=1;
                cout<<"not palindrome\n";
                break;
            }
        }
        if(!jizz){
            cout<<"palindrome\n";
        }
        jizz=0;
    }
}

沒有留言:

張貼留言