Source Code
#include<iostream>
using namespace std;
long long a[100000];
int ret(int s) {
	
		int sum = 0;
		int rem = s % 9;
		return rem == 0 ? 9 : rem;

		
}
int main() {
	int n;
	cin >> n;
	int x = 0;
	for (int i = 0;i < n;i++)
	{
		cin >> a[i];
		x += a[i];
		cout << ret(x);
	}
	
	
	
	}




	
Copy
The Tale of a Generous Prince hadeelYasir
GNU G++17
3 ms
232 KB
Wrong Answer