好讨厌Runtime error
终于遇到水题了
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include<stdio.h>
#include<string>
using namespace std;
int t, n, k;
string s;
int main()
{
scanf("%d", &t);
while (t--) {
scanf("%d%d", &n, &k);
cin >> s;
if (2 * k >= n) {
printf("NO\n");
continue;
}
if (k == 0) {
printf("YES\n");
continue;
}
int flag = 0;
//int m = n / 2-1;
for (int i = 0; i < k; i++) {
if (s[i] == s[n - i - 1]) {
flag++;
}
}
if (flag!=k)
printf("NO\n");
else
printf("YES\n");
}
return 0;
}