#include <iostream>
#include <set>
using namespace std;
int f(int num)
{
int sum = 0;
while (num)
{
sum += num % 10;
num /= 10;
}
return sum;
}
int main()
{
set<int> s;
int n, num;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num;
s.insert(f(num));
}
cout << s.size() << endl;
for (auto it = s.begin(); it != s.end(); it++)
{
if (it != s.begin())
{
cout << " ";
}
cout << *it;
}
return 0;
}
1064 朋友数
最新推荐文章于 2023-07-18 10:48:03 发布