Source Code
#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;
	int t;
	int fD;
	int sD;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> t;
		if (t > 9) {
			fD = t / 10;
			sD = t % 10;
			fD += sD;
			sum += fD;
		}
		else {
			sum += t;
		}
	}

	if (sum > 9) {
		fD = sum / 10;
		sD = sum % 10;
		sum = fD + sD;
	}

	cout << sum << endl;

	return 0;
}
Copy
The Tale of a Generous Prince psutMoha
GNU G++17
3 ms
672 KB
Wrong Answer