# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198073 | ZwariowanyMarcin | Trol (COCI19_trol) | C++14 | 12 ms | 396 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>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define LL long long
#define ld double
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define boost cin.tie(0), ios_base::sync_with_stdio(0);
using namespace std;
int T;
LL a, b;
int main() {
scanf ("%d", &T);
while (T--) {
LL c = 0;
scanf ("%lld%lld", &a, &b);
for (int i = 0; i < 9; ++i) {
LL l = a;
while (l % 9 != i) l++;
LL r = b;
while (0 <= r && r % 9 != i) r--;
int x = (i == 0 ? 9 : i);
if (l <= r)
c += 1LL * x * ((r - l) / 9 + 1);
}
printf ("%lld\n", c);
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |