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