题目描述
知识点: 模拟
思路: 水题
#include<iostream>
#include<set>
using namespace std;
const int N = 1e4+10;
int get_num(int x){
int res = 0;
while(x){
res += x % 10;
x /= 10;
}
return res;
}
int main(){
set<int> numbers;
int n;
cin>>n;
while(n--){
int a;
cin>>a;
numbers.insert(get_num(a));
}
cout<<numbers.size()<<endl;
for(auto i = numbers.begin();i != numbers.end();i++){
if(i == numbers.begin()) cout<<*i;
else cout<<" "<<*i;
}
return 0;
}