求助,WA后四点
查看原帖
求助,WA后四点
628691
EthanSong楼主2024/1/23 21:10

手写哈希,调了一个小时没调出来,急死我了

本人若无法及时回复,请谅解

记录记录

代码代码

#include <bits/stdc++.h>
using namespace std;
const int mod = 1e7 + 19;
bool a[mod];
void hashi(int x) {
	if (!a[(x % mod + mod) % mod]) a[(x % mod + mod) % mod] = true, cout << x << " ";
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin >> t;
	while (t--) {
		memset(a, 0, sizeof(a));
		int n, x;
		cin >> n;
		for (int i = 1; i <= n; i++) cin >> x, hashi(x);
		cout << endl;
	}
	return 0;
}
2024/1/23 21:10
加载中...