题解 | #明明的随机数#

明明的随机数

https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0

// HJ3 明明的随机数.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include<bits/stdc++.h>

using namespace std;

class Solution {
public:
	void Random(vector<int>& str);
};

void Solution::Random(vector<int>& str)
{
	sort(str.begin(), str.end());
	str.erase(unique(str.begin(), str.end()), str.end());
	for (auto x : str)
		cout << x << endl;
}
int main()
{
	Solution a;
	int n;
	while (cin >> n)
	{
		vector<int>dp(n);
		for (int i = 0; i < n; i++)
			cin >> dp[i];
		a.Random(dp);
	}
	return 0;
}

全部评论

相关推荐

03-04 22:09
已编辑
南昌大学 golang
西北上单:29届? 请你去三角洲猛攻
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务