# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256862 | dolijan | Trol (COCI19_trol) | C++14 | 1 ms | 384 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>
typedef long long ll;
#define pb push_back;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int q;
cin>>q;
while(q--)
{
ll l,r;
cin>>l>>r;
ll k=l;
ll suma=0;
while(k%9!=0 && k<=r)
{
suma+=(k%9);
k++;
}
//cout<<suma<<endl;
ll m=r;
while(m>=k && m%9!=0)
{
suma+=(m%9);
m--;
}
/*cout<<suma<<endl;
cout<<m<<" "<<k<<endl;*/
if(m%9==0) suma+=9;
cout<<((m-k)/9)*45+suma<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |