# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974833 | vjudge1 | Trol (COCI19_trol) | C++17 | 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>
#define endl '\n'
#define ll long long
using namespace std;
int sembilan[] = {9, 1, 2, 3, 4, 5, 6, 7, 8};
int q;
ll l, r;
int toDigit(ll i) {
return sembilan[i%9];
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(nullptr);
cin >> q;
while(q--) {
cin >> l >> r;
ll ans = 0;
ans += ((r-l)/9)*45;
r = ((r-l)%9)+l;
for(ll i = l;i <= r; i++) {
ans += toDigit(i);
}
cout << ans << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |