# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
487607 |
2021-11-16T09:31:58 Z |
KazamaHoang |
Trol (COCI19_trol) |
C++14 |
|
1 ms |
312 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int ntest;
for (cin >> ntest; ntest --;) {
long long l, r;
cin >> l >> r;
auto f = [&](long long x) {
long long numBlock = x / 9;
int rem = x - numBlock * 9;
return numBlock * 45 + (rem + 1) * rem / 2;
};
cout << f(r) - f(l-1) << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
252 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
208 KB |
Output is correct |