Advertisement
6ya

該死的迴紋針

6ya
Jan 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<cstring>
  4. #include<vector>
  5. using namespace std;
  6.  
  7. int main(){    
  8.     int range;
  9.     cin >> range;
  10.     for(int i = 0; i < range; i++){
  11.         string str;
  12.         cin >> str;
  13.         char* c = new char[100000];
  14.         strcpy(c,str.c_str());
  15.         string reverse = "";
  16.         for(int i = str.length() - 1; i >= 0; i--){
  17.             reverse += c[i];
  18.         }
  19.         if(reverse == str){
  20.             cout << "Yes" << endl;
  21.         }else{
  22.             cout << "No" << endl;
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement