# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723489 | Dulguun88 | Trol (COCI19_trol) | C++14 | 1080 ms | 296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |