# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
319325 | gustason | Trol (COCI19_trol) | C++14 | 1 ms | 364 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 llint;
int q;
int main(void) {
scanf("%d", &q);
while (q--) {
llint l, r;
scanf("%lld%lld", &l, &r);
llint tot = r - l + 1;
llint sol = (tot / 9) * 9 * 10 / 2;
for (int i = 0; i < tot % 9; ++i) {
int add = (int) ((l + i) % 9);
if (add == 0) add = 9;
sol += (llint) add;
}
printf("%lld\n", sol);
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |