| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 837259 | LinkedArray | Trol (COCI19_trol) | C++17 | 1 ms | 304 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() {
    long long q, l, r, d, repeating, cif, sum;
    cin >> q;
    while(q--){
        cin >> l >> r;
        sum = 0;
        repeating = (r - l + 1) / 9;
        cif = (l - 1 + 9) % 9 + 1;
        if(cif != 1){
            sum = 45 - ((cif - 1) * cif / 2); 
        }
        sum += 45 * repeating;
        cif = (r - 1 + 9) % 9 + 1;
        if(cif != 9){
            sum += cif * (cif + 1) / 2;
        }
        cout << sum << '\n';
    }
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
