# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
256862 |
2020-08-03T10:18:05 Z |
dolijan |
Trol (COCI19_trol) |
C++14 |
|
1 ms |
384 KB |
#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 |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |