内存炸了!(0分)
查看原帖
内存炸了!(0分)
1374442
x_Toi_QiQi楼主2024/10/16 19:38
#include <bits/stdc++.h>
using namespace std;

const int maxn = 100005;
map <int, int> cnt;

void bj(int n) {
	int maxx = 0;
	int a;
	for (int i = 1; i <= n; ++i) {
		cin >> a;
		++cnt[a];
		maxx = max(maxx, a);
	}
	for (int i = 1; i <= maxx; ++i)
		if (cnt[i] >= 1) cout << i << " " << cnt[i] << "\n";
}

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	bj(n);
	return 0;
}

都没有大佬帮帮蒟蒻QAQ

2024/10/16 19:38
加载中...