https://www.luogu.org/problem/P1059
#include<bits/stdc++.h> using namespace std; set<int>s; int a[105]; int main() { int n; cin>>n; for(int i=0; i<n; i++) { cin>>a[i]; s.insert(a[i]); } cout<<s.size()<<endl; while(!s.empty()) { cout<<*s.begin()<<" "; //注意此处的用法 s.erase(s.begin()); } return 0; }