Submission #251504

# Submission time Handle Problem Language Result Execution time Memory
251504 2020-07-21T14:44:39 Z MrRobot_28 Trol (COCI19_trol) C++17
50 / 50
1 ms 384 KB
#include<bits/stdc++.h>
 
using namespace std;
#define int long long
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q;
	cin >> q;
	while(q--)
	{
		int l, r;
		cin >> l >> r;
		int sum = 0;
		sum += 45 * (r / 9);
		while(r % 9 != 0)
		{
			sum += r % 9;
			r--;
		}
		l--;
		sum -= 45 * (l / 9);
		while(l % 9 != 0)
		{
			sum -= l % 9;
			l--;
		}
		cout << sum << "\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct