为什么长度有出错
查看原帖
为什么长度有出错
1288786
meiweid_quanyiang楼主2025/1/13 11:36

如题看代码

#include<bits/stdc++.h>
using namespace std;
struct myset{
	char a[410];
	int l=0;
	bool repeat(char c){
		int t=l;
		while(t--)if(a[t]==c)return false;
		return true;
	}
	void push(char i){
		if(!repeat(i))return;
		else {
			l++;
			a[l]=i;
		}
	}
	void pop(int i){
		if(i>l)return;
		l--;
		for(;i<=l;i++)a[i]=a[i+1];
	}
};
int main(){
	myset a;
	a.push('o');
	a.push('o');
	if(a.repeat('o'))cout<<1;
	cout<<a.l;
}
2025/1/13 11:36
加载中...