# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
205145 |
2020-02-28T07:31:16 Z |
mraron |
Trol (COCI19_trol) |
C++14 |
|
6 ms |
380 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int T;
cin>>T;
while(T--) {
ll l,r;
cin>>l>>r;
ll ans=0;
//0 1 2 3 4 5 6 7 8
while(l<=r && l%9!=0) {
ans+=(l%9==0?9:l%9);
l++;
}
while(l<=r && r%9!=8) {
ans+=(r%9==0?9:r%9);
r--;
}
ans+=(r-l+1)*5;
cout<<ans<<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
364 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
380 KB |
Output is correct |
4 |
Correct |
6 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |