首页 > 其他 > 详细

1064 朋友数 (20 point(s))

时间:2021-09-07 15:26:41      阅读:11      评论:0      收藏:0      [点我收藏+]
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, tmp, a, b, c, d, first = 0;
	set<int> fri;
	cin >> n;
	
	while(n--){
		cin >> tmp;
		a = tmp % 10;
		b = tmp / 10 % 10;
		c = tmp / 10 / 10 % 10;
		d = tmp / 10 / 10 / 10; 
		fri.insert(a + b + c + d);
	}
	cout << fri.size() << endl;
	for(auto f: fri) cout << (first++ ? " " : "") << f;
}

1064 朋友数 (20 point(s))

原文:https://www.cnblogs.com/Atl212/p/15236625.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!