# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
487607 | KazamaHoang | Trol (COCI19_trol) | C++14 | 1 ms | 312 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;
int main() {
cin.tie(0)->sync_with_stdio(0);
int ntest;
for (cin >> ntest; ntest --;) {
long long l, r;
cin >> l >> r;
auto f = [&](long long x) {
long long numBlock = x / 9;
int rem = x - numBlock * 9;
return numBlock * 45 + (rem + 1) * rem / 2;
};
cout << f(r) - f(l-1) << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |