# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
974843 | vjudge1 | Trol (COCI19_trol) | C++98 | 1 ms | 348 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 f(long long l,long long r){
long long ret=0;
long long awal=l;
for (long long i = l; i<=r; i++)
{
ret+=i%9;
awal=i;
if(i%9==0){
ret+=9;
break;
}
}
long long akhir=awal;
for (long long i = r; i%9!=0 && i>awal; i--)
{
ret+=i%9;
akhir=i;
}
if(r%9==0 ){
ret+=((r-awal)/9)*45;
}else{
ret+=((akhir-awal)/9)*45;
}
return ret;
}
int main(){
int q;
cin>>q;
while ( q--)
{
long long l,r;
cin>>l>>r;
cout<<f(l,r)<<endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |