C++代码
2026-10-03 13:46:33
发布于:湖南
0阅读
0回复
0点赞
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n,m,a[110],b[110];
bool c = false;
int main()
{
cin >> n;
for( int i = 0; i < n; i++ ) cin >> a[i];
for( int i = 0; i < n; i++ )
{
c = false;
for( int j = 0; j < i; j++ )
{
if( a[j] == a[i] )
{
c = true;
break;
}
}
if( !c )
{
b[m++] = a[i];
}
}
sort( b, b+m );
cout << m << endl;
for( int i = 0; i < m; i++ )
{
if( i > 0 ) cout << " ";
cout << b[i];
}
return 0;
}
//未经授权,禁止更改、抄袭。
这里空空如也






有帮助,赞一个