输出 0 绷不住了,while 循环直接被无视了!
abc_363_c
#include<bits/stdc++.h>
#define int long long
using namespace std;
string s;
int x,k,ans;
bool ish(string x){
for(int i=0,j=x.size()-1;i<j;i++,j--){
if(x[i]!=x[j])return 0;
}
return 1;
}
signed main(){
cin>>x>>k;
cin>>s;
while(next_permutation(s.begin(),s.end())){
cout<<s<<'\n';
int b=1;
for(int i=0;i<=s.size()-k;i++){
string tmp=s.substr(i,k);
if(ish(tmp)){
b=0;
break;
}
}
ans+=b;
}
cout<<ans;
return 0;
}