24 lines
407 B
C++
24 lines
407 B
C++
|
|
#include<bits/stdc++.h>
|
||
|
|
using namespace std;
|
||
|
|
set<int>s;
|
||
|
|
int main(){
|
||
|
|
int n;
|
||
|
|
cin>>n;
|
||
|
|
for(int i=1;i<=n;i++){
|
||
|
|
int t;
|
||
|
|
cin>>t;
|
||
|
|
int cnt=0;
|
||
|
|
while(t!=0){
|
||
|
|
int a=t%10;
|
||
|
|
cnt+=a;//加出朋友数的和
|
||
|
|
t/=10;
|
||
|
|
}
|
||
|
|
s.insert(cnt);//可以利用set的去重
|
||
|
|
}
|
||
|
|
cout<<s.size()<<endl;//已经去完了
|
||
|
|
|
||
|
|
for(auto it=s.begin();it!=s.end();it++){
|
||
|
|
cout<<*it<<endl;
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|