# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
205605 | mayhoubsaleh | Trol (COCI19_trol) | C++14 | 6 ms | 376 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 pb push_back
#define ll long long
#define mid (l+r)/2
#define left 2*i+1
#define righ 2*i+2
using namespace std;
ll q;
ll l,r;
ll sum(ll x){
ll ret=(x/9)*45;
x%=9;
ret+=x*(x+1)/2;
return ret;
}
int main()
{
cin>>q;
while(q--){
cin>>l>>r;
cout<<sum(r)-sum(l-1)<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |