Submission #968669

# Submission time Handle Problem Language Result Execution time Memory
968669 2024-04-23T19:59:30 Z RandomUser Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include <iostream>
using namespace std;
using ll = long long;
 
int main() {
    int q;
    cin >> q;
 
    while(q--) {
        ll l, r;
        cin >> l >> r;
        ll ans = (r - l + 1) / 9 * 45;
        for(int i=0; i<(r-l+1)%9; i++)
            ans += ((l + i) % 9 == 0 ? 9 : (l + i) % 9);
        cout << ans << '\n';
    }
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct