ABCD

A:贪心 B:讨论 C:贪心 D:讨论

#include<iostream>
#include<cstring>
#include<cstdio>
#include<climits>
#include<algorithm>
#include<queue>
#include<vector>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
inline int read(){
    int f=1,ans=0; char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
    return f*ans;
}
const int MAXN=1e3+11;
int T,N,K; char S[MAXN];
int main(){
    T=read(); while(T--){
        N=read(),K=read(); scanf("%s",S+1); bool ff=1;
        for(int i=1;i<=K;i++) if(S[i]!=S[N-i+1]){ff=0;break;}
        if(!ff){printf("NO\n");continue;}
        int L=K+1,R=N-K;
        if(L>R){printf("NO\n");continue;}
        printf("YES\n");
    }return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2022-03-04
  • 2021-10-27
  • 2021-06-08
  • 2022-12-23
  • 2021-08-25
  • 2021-05-19
  • 2021-07-14
猜你喜欢
  • 2022-02-10
  • 2022-02-05
  • 2021-08-21
  • 2021-10-17
  • 2022-12-23
  • 2021-08-21
  • 2022-02-21
相关资源
相似解决方案