# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974702 | vjudge1 | Trol (COCI19_trol) | C++14 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll get_range(ll l, ll r) {
l--;
ll a = (l/ 9) * 45;
ll b = (r / 9) * 45;
for (int i = 1; i <= l % 9; i++) a += i;
for (int i = 1; i <= r % 9; i++) b += i;
return b - a;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int q;
cin >> q;
while (q--) {
ll l, r;
cin >> l >> r;
cout << get_range(l,r) << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |