1117:整数去重

#include <iostream>
using namespace std;
int main()
{
	int n;
	int s[20001]={0};
	int a[20001]={0};
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>s[i];
		for(int j=0;j<i;j++)
		{
			if(s[i]==s[j])
			{
				a[i]=1;
				break;
			}		
		}
	}
	
	for(int x=0;x<n;x++)
	{
		if(a[x]==0)
		{
			cout<<s[x]<<" ";
		}
	} 
}
posted @ 2022-05-24 22:07  四面楚歌2022  阅读(733)  评论(0)    收藏  举报