Submission #903966

# Submission time Handle Problem Language Result Execution time Memory
903966 2024-01-11T15:45:20 Z vjudge1 Trol (COCI19_trol) C++17
30 / 50
1000 ms 456 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int q;
	cin >> q;
	while(q--){
		long long l, r;
		cin >> l >> r;
		long long res = 0;
		for(long long i = l;i <= r;++i){
			long long temp = i;
			while(temp > 9){
				long long sum = 0;
				while(temp){
					sum += temp % 10;
					temp /= 10;
				}
				temp = sum;
			}
			res += temp;
		}
		cout << res << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Execution timed out 1004 ms 348 KB Time limit exceeded
5 Execution timed out 1088 ms 456 KB Time limit exceeded