# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
229215 |
2020-05-03T21:01:47 Z |
VEGAnn |
Trol (COCI19_trol) |
C++14 |
|
6 ms |
256 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans(ll x){
ll res = x / 9ll * (45ll);
ll ost = x % 9;
for (ll i = 1; i <= ost; i++)
res += i;
return res;
}
int main(){
int qq; cin >> qq;
for (; qq; qq--){
ll l, r;
cin >> l >> r;
cout << ans(r) - ans(l - 1) << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
256 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
256 KB |
Output is correct |