Submission #1027014

# Submission time Handle Problem Language Result Execution time Memory
1027014 2024-07-18T18:36:51 Z HasanV11010238 Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll su(ll x){
	ll ret = 45 * (x / 9);
	ll val = x % 9;
	ret += val * (val + 1) / 2;
	return ret;
}
int main(){
	ll q, a, b;
	cin>>q;
	while (q--){
		cin>>a>>b;
		cout<<su(b) - su(a - 1)<<"\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct