开O2WA了五个点,不开过了
查看原帖
开O2WA了五个点,不开过了
1237073
nyczh楼主2024/4/14 17:01

个人认为天衣无缝

#include <bits/stdc++.h>
using namespace std;

const int N = 105;
int a[N];
bool cnt[N];
int main() {
	int n,b,q,tmp = 0;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++) {
		scanf("%d",&b);
		if(!cnt[b]) {
			tmp++;
			a[tmp] = b;
			cnt[b] = true;
		}
	}
	printf("%d\n",tmp);
	sort(a+1,a+tmp+1);
	for(int i = 1; i <= tmp; i++) {
		printf("%d ",a[i]);
	}
	return 0;
}
2024/4/14 17:01
加载中...