Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
447 B
1
Indexable
#include <iostream>
using namespace std;
int main()
{
	int a, i, n, b, e, len = 0, summ = 0, max = 1, maxi = 0, c,j;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		summ = 0;
		len = 0;
		cin >> a;
		b = a;
		while (b > 0) {
			b /= 10;
			len += 1;
			
		}
		c = a;
		for (j = 0; j < len; j++)
		{
			summ += c % 10;
			c /= 10;

		}
		if (max < summ) {
			max = summ;
			maxi = a;
		}




	}	
	cout << max << maxi;
}