Educational Codeforces Round 49 (Rated for Div. 2)A. Palindromic Twist

  1. problem link:http://codeforces.com/contest/1027/problem/A
  2. 第一次写用了48行,第二次写用了12行。还是做题太少。心塞塞。
    小闵呀,加油!!!
#include
using namespace std;
int main(){
    int T;cin>>T;
    while(T--){
        int i,j,n,flag=1;string s;cin>>n>>s;
        for(i=0,j=n-1;iif(s[i]==s[j])continue;
            if(!(abs(s[i]-s[j])==2))flag=0;
        }
        if(flag)puts("YES");else puts("NO");
    }
}

你可能感兴趣的:(codeforces,模拟题目)