孩子不听话,作为家长应该如何调教?
  • 板块灌水区
  • 楼主Igallta
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/7/21 15:14
  • 上次更新2024/7/21 15:15:59
查看原帖
孩子不听话,作为家长应该如何调教?
813622
Igallta楼主2024/7/21 15:14

输出 00 绷不住了,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;
}
2024/7/21 15:14
加载中...