# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
823843 | Sandarach151 | Trol (COCI19_trol) | C++17 | 1 ms | 316 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;
long long func(long long x){
if(x%9==0){
return 9;
}
else{
return x%9;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long t;
cin >> t;
while(t--){
long long a, b;
cin >> a >> b;
long long ans = 0;
while(a%9!=1 && a<=b){
ans+=func(a);
a++;
}
while(b%9!=0 && b>=a){
ans+=func(b);
b--;
}
ans+=5*(b-a+1);
cout << ans << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |