Submission #1340641

#TimeUsernameProblemLanguageResultExecution timeMemory
1340641kawhietTrol (COCI19_trol)C++20
50 / 50
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int q;
    cin >> q;
    while (q--) {
        int a, b;
        cin >> a >> b;
        int ans = (b - a) / 9 * 45;
        for (int i = a + (b - a) / 9 * 9; i <= b; i++) {
            ans += (i % 9 == 0 ? 9 : i % 9);
        }
        cout << ans << '\n';
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...