Submission #974696

# Submission time Handle Problem Language Result Execution time Memory
974696 2024-05-03T16:10:07 Z vjudge1 Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int q;
    unsigned long long l, r, res = 0;
    cin >> q;
    while (q--) {
        cin >> l >> r;
        unsigned long long quo, rem, tmp;
        quo = (r-l+1)/9;
        rem = (r-l+1)%9;
        tmp = (l-1)%9+1;
        res = 45*quo;
        while (rem--) {
            res += tmp;
            tmp++;
            tmp = (tmp-1)%9+1;
        }
        cout << res << endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct