Submission #723489

# Submission time Handle Problem Language Result Execution time Memory
723489 2023-04-13T23:32:04 Z Dulguun88 Trol (COCI19_trol) C++14
0 / 50
1000 ms 296 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int T;
    cin>>T;
    while(T--){
        ll l, r;
        cin >> l >> r;
        ll sum = 0;
        while(l<=r && (l%9)!=1){
            ll x = l%9;
            if(x==0) x = 9;
            sum+=x;
            l++;
        }
        while(r>=l ){
            sum+=(r%9);
            r--;
        }
        if(r-l+1>0){
            ll len=(r-l+1)/9;
            sum+=(len*45);
        }
        cout << sum << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Incorrect 1 ms 296 KB Output isn't correct
4 Execution timed out 1080 ms 212 KB Time limit exceeded
5 Execution timed out 1078 ms 212 KB Time limit exceeded