zoukankan      html  css  js  c++  java
  • Mr. Kitayuta's Gift

     1 //回文判断 Codeforces Round #286 (Div. 2)
     2 #include<iostream>
     3 #include<cstdio> 
     4 int main()
     5 {
     6     string f,temp; cin>>f;
     7     int len(f.size());
     8     for(char c ='a';c<='z';c++)
     9     {
    10         temp.clear();
    11         temp.push_back(c);
    12         for(int i=0;i<=len;i++)
    13         {
    14             string spre = f.substr(0,i);
    15             string stail = f.substr(i,len-i);
    16             string s1 = spre + temp + stail;
    17             string s2 = s1;
    18             reverse(s2.begin(),s2.end());   //翻转字符串
    19             if(s1 == s2) {cout<<s1<<endl;return 0;}
    20         }
    21     }
    22     printf("NA
    ");
    23     return 0;
    24 }
    View Code
  • 相关阅读:
    vim
    echo
    kill/xkill/killall/pkill/pidof
    ssh
    使用GSON
    使用GSON
    解析JSON
    解析JSON
    Pull解析方式
    Pull解析方式
  • 原文地址:https://www.cnblogs.com/NWUACM/p/6656408.html
Copyright © 2011-2022 走看看