Submission #977094

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

ll bil (ll n){
    ll ret= (n/9)* 45;
    for (int i=1; i<=n%9; i++) ret+=i;
    return ret;
}

int main(){
    int q;
    cin >> q;
    for (int i=0; i<q; i++){
        ll l, r;
        cin >> l >> r;
        cout << bil(r) - bil(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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct