Submission #975476

# Submission time Handle Problem Language Result Execution time Memory
975476 2024-05-05T09:02:21 Z vjudge1 Trol (COCI19_trol) C++
0 / 50
1 ms 584 KB
#include <bits/stdc++.h>
using namespace std;

int calc(int num){
	int ans = 0;
	while(num != 0){
		ans += num % 10;
		num /= 10;
	}
	return ans;
}

int main(){
	int Q, L, R, ans1, ans2, temp;
	cin >> Q;
	for(int j =0; j<Q; j++){
		cin >> L;
		ans1 = calc(L);
		while(ans1 > 10){
			temp = calc(ans1);
			ans1 = temp;
		}
		cin >> R;
		ans2 = calc(R);
		while(ans2 > 10){
			temp = calc(ans2);
			ans2 = temp;
		}
		if(ans1 != ans2){
			cout << ans1 << ans2 << endl;
		}else{
			cout << ans1 << endl;
		}	
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 584 KB Output isn't correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Incorrect 0 ms 432 KB Output isn't correct