# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1249350 | amaw | Trol (COCI19_trol) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long q;
cin >> q;
while(q--) {
long long x, y;
cin >> x >> y;
x--;
long long sumHigh = 0, sumLow = 0;
for (int i = 1; i <= y % 9; i++) sumHigh += i;
for (int i = 1; i <= x % 9; i++) sumLow += i;
long long ans = (45 * (y / 9) + sumHigh) - (45 * (x / 9) + sumLow);
cout << ans << endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |