# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
456155 |
2021-08-06T07:28:23 Z |
Jasiekstrz |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
316 KB |
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
long long f(long long x)
{
long long d=x/9,r=x%9;
return d*45+r*(r+1)/2;
}
void solve()
{
long long l,r;
cin>>l>>r;
cout<<f(r)-f(l-1)<<"\n";
return;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int qq;
cin>>qq;
while(qq--)
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
316 KB |
Output is correct |