# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288342 | Lawliet | Trol (COCI19_trol) | C++17 | 1 ms | 288 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 int lli;
lli getValue(lli k)
{
if( k%9 != 0 ) return k%9;
return 9;
}
int main()
{
int n;
scanf("%d",&n);
while( n-- )
{
lli L, R;
scanf("%lld %lld",&L,&R);
lli ans = 0;
while( L%9 != 1 && L <= R )
ans += getValue( L++ );
while( R%9 != 0 && L <= R )
ans += getValue( R-- );
lli sz = (R - L + 1)/9;
ans += sz*45;
printf("%lld\n",ans);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |