菜鸡


私信TA

用户名:ph1134370710

访问量:25465

签 名:

任花自飘零水自流

等  级
排  名 92
经  验 8506
参赛次数 8
文章发表 54
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<bits/stdc++.h>
using namespace std;
int f(int a,int b)
{
	return a<b;
}
int main()
{
	int n;
	while(cin>>n&&n!=0)
	{
		set<int> a;
		int s=0;
		set<int>::iterator it;
		for(int i=0;i<n;i++)
		{
			int t;
			cin>>t;
			if(a.find(t)==a.end()) s++;
			a.insert(t);
		}
		cout<<s<<endl;

		for(it=a.begin();it!=a.end();it++)
			cout<<*it<<" ";
		cout<<endl<<endl;
		a.clear();
	}
	return 0;
 }


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区