神奇的代码
查看原帖
神奇的代码
766647
_Chjich_楼主2024/10/5 17:05

过了,但有疑惑。

//60分
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long T;
long long n, x, sum;
unordered_map<int, int>f;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> T;
	while (T--) {
		++sum;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			if (f[x] != sum)
				f[x] = sum, cout << x << " ";
		}
		cout << "\n";
	}
	return 0;
}
//90分,第七个点错
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long T;
long long n, x, sum;
unordered_map<int, int>f;

int main() {
	ios::sync_with_stdio(false);//这
	cin.tie(0), cout.tie(0);
	cin >> T;
	while (T--) {
		++sum;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			if (f[x] != sum)
				f[x] = sum, cout << x << " ";
		}
		cout << "\n";
	}
	return 0;
}
//90分,第九个点错
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long T;
long long n, x, sum;
unordered_map<int, int>f;

int main() {
	ios::sync_with_stdio(0);//这
	cin.tie(0), cout.tie(0);
	cin >> T;
	while (T--) {
		++sum;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			if (f[x] != sum)
				f[x] = sum, cout << x << " ";
		}
		cout << "\n";
	}
	return 0;
}
//70分,第七,八,十个点错
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long T;
long long n, x, sum;
unordered_map<int, int>f;

int main() {
	ios::sync_with_stdio(false);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> T;
	while (T--) {
		++sum;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			if (f[x] != sum)
				f[x] = sum, cout << x << " ";
		}
		cout << "\n";
	}
	return 0;
}
//100分
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long T;
long long n, x, sum;
unordered_map<int, int>f;

int main() {
	ios::sync_with_stdio(false);
	ios::sync_with_stdio(0);//这
	ios::sync_with_stdio(0);
	ios::sync_with_stdio(0);
	ios::sync_with_stdio(0);
	ios::sync_with_stdio(0);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> T;
	while (T--) {
		++sum;
		cin >> n;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			if (f[x] != sum)
				f[x] = sum, cout << x << " ";
		}
		cout << "\n";
	}
	return 0;
}
2024/10/5 17:05
加载中...