# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338938 | A_D | Trol (COCI19_trol) | C++14 | 1 ms | 364 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>
#define ll long long
#define int long long
#define F first
#define S second
using namespace std;
ll f(int v)
{
if(v==0)return 0;
ll k=v/9;
ll ret=k*9*5;
v=v%9;
ret+=v*(v+1)/2;
return ret;
}
main()
{
int q;
cin>>q;
while(q--)
{
ll l,r;
cin>>l>>r;
ll ans=-f(l-1);
ans+=f(r);
cout<<ans<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |