Submission #976016

# Submission time Handle Problem Language Result Execution time Memory
976016 2024-05-06T05:07:56 Z vjudge1 Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll cek(ll r){
    ll ans = (r / 9) * 45;
    for(ll i = 1; i <= r % 9; i++){
        ans += i;
    }
    return ans;
}

int main(){
    ll q, l, r;
    cin >> q;
    for(ll i = 0; i < q; i++){
        cin >> l >> r;
        cout << cek(r) - cek(l - 1) << endl;
    }
    return 0;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct