精神状态异常
  • 板块灌水区
  • 楼主zjw806903
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/2/6 17:40
  • 上次更新2025/2/6 18:31:52
查看原帖
精神状态异常
894358
zjw806903楼主2025/2/6 17:40

RT。

有没有什么好方法(

主要表现为打数据结构极易出错且容易弘文。

#include <bits/stdc++.h>
using namespace std;
char c[11111111],ok[114]="wssb";
int len,flag;
int main(){
	freopen("rand.out","w",stdout);
	srand(time(0));
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	while(1){
		char ls=rand()%26+'a';
		c[++len]=ls;
		if(len>=4){
			flag=0;
			for(int i=len-3;i<=len;i++){
				if(c[i]!=ok[i-len+3]){
					flag=1;
					break;
				}
			}
			if(flag==0){
				for(int i=1;i<=len;i++){
					cout<<c[i];
				}
				cout<<'\n'<<len;
				return 0;
			}
		}
	}
	return 0;
}
2025/2/6 17:40
加载中...