题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
#include <algorithm>
using namespace std;
int main()
{
int n; //随机数个数n
int num; //每次的输入数据
int data[1000] = { 0 };
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", &num);
data[i] = num;
//cout << data[i] << endl;
}
//排序
sort(data, data+n);
//去重
int nn = unique(data, data+n) - data;
for(int i = 0; i < nn; i++)
cout << data[i] << endl;
}