Submission #977006

# Submission time Handle Problem Language Result Execution time Memory
977006 2024-05-07T10:17:10 Z vjudge1 Trol (COCI19_trol) C++17
50 / 50
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main(){
    int q;
    cin>>q;
    while (q--){
        ll l,r;
        cin>>l>>r;
        ll a=(r-l+1)/9;
        ll b=a*45;
        for (ll c=l+9*a;c<=r;c++)b+=(c+8)%9+1;
        cout<<b<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct