# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968635 | VMaksimoski008 | 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;
using ll = long long;
int main() {
int q;
cin >> q;
auto Q = [&](int p) {
if(!p) return 0ll;
int full = p / 9;
ll ans = full * 45;
for(int i=full*9+1; i<=p; i++) ans += i % 9;
return ans;
};
while(q--) {
int l, r;
cin >> l >> r;
cout << Q(r) - Q(l-1) << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |