Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
401 B
0
Indexable
Never
#include <iostream>
using namespace std;
int main() {
    int a, b,c[10000],d,e=0,z1,z2;
    cin >> a;
	z1 = c[0];
	z2 = c[1];
	for (int i = 0; i < a; i++){
		cin >> b;
		c[i] = b;
	}
	for (int i = 0; i < a; i++){
		z2 = e;
		d = c[i];
		while (c[i] != 0){
			e += c[i] % 10;
			c[i] /= 10;
		}

		c[i]=d;
		if (z2 < e) {
			z2=e;
		}
		e = 0;
	}
	cout << d << " " << z2;

}