![【noiOJ】p7914(..) 【noiOJ】p7914(..)](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
08:不重复地输出数
- 总时间限制:
- 1000ms
- 内存限制:
- 65536kB
- 描述
-
输入n个数,从小到大将它们输出,重复的数只输出一次。保证不同的数不超过500个。
- 输入
- 第一行是一个整数n。1 <= n <= 100000。
之后n行,每行一个整数。整数大小在int范围内。 - 输出
- 一行,从小到大不重复地输出这些数,相邻两个数之间用单个空格隔开。
- 样例输入
-
5
2 4 4 5 1 - 样例输出
-
1 2 4 5
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a[],n,i;
int main()
{
scanf("%d",&n);
for (i=;i<=n;i++)
scanf("%d",&a[i]);
sort(a+,a+n+);
printf("%d ",a[]);
for (i=;i<=n;i++)
if (a[i]!=a[i-])
printf("%d ",a[i]);
return ;
}