Source Code
#include <iostream>
using namespace std;

int main() {
	
	int n;
	unsigned long long sum=0;
	cin>>n;
	for(int i=0; i<n;i++){
		unsigned long long input;
		cin>>input;
		while(input!=0){
			sum+=input%10;
			input/=10;
		}
	}
	int finalsum=0;
	while(sum!=0)
	{
		finalsum+=sum%10;
		sum/=10;
	}
	cout<<finalsum;
	return 0;
}
Copy
The Tale of a Generous Prince samihamad
GNU G++17
50 ms
1.0 MB
Wrong Answer