# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
249499 | shafinalam | Trol (COCI19_trol) | C++14 | 1 ms | 256 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;
scanf("%d", &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 && (r%9)!=0)
{
sum+=(r%9);
r--;
}
if(r-l+1>0)
{
ll len = (r-l+1)/9;
sum+=(len*45);
}
cout << sum << '\n';
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |