关于数组清空方式
查看原帖
关于数组清空方式
1153677
Treap_Kongzs楼主2024/7/27 22:33

省流:memsetmemset的本题写法是

memset(cnt,0,sizeof(int)*idx*2)

其实你写forfor也可以

更不要像我这个蒟蒻 of 工程转er这样qwq(保留核心代码)

笑点解析:C++语言特性

struct trie
{
	int children[maxn][62];
	int cnt[maxn];
	int id;
	
	void insert(string s);
	int find(string s);
};

void trie::insert(string s)
{
	//It is right,so I deleted
}

int trie::find(string s)
{
	//It is right,so I deleted
}

int main()
{
	int t=0,n=0,m=0;
	string s;
	cin>>t;
	for()//at t
	{
		cin>>n>>m;
		trie* tries=new trie;//did you see?
		
		for(int j=1;j<=n;j++)
		{
			cin>>s;
			tries->insert(s);//did you see?
		}
		for(int j=1;j<=m;j++)
		{
			cin>>s;
			cout<<tries->find(s);//did you see?
			if(j<m)cout<<endl;
		}
		delete tries;//did you see?
		if(i<t)cout<<endl;
	}
	return 0;
}
2024/7/27 22:33
加载中...