Submission #974828

# Submission time Handle Problem Language Result Execution time Memory
974828 2024-05-03T20:47:39 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#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 = l+(((r-l)+1)%9)-1;
        for(ll i = l;i <= r; i++) {
            ans += toDigit(i);
        }
        cout << ans << endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct