# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974702 |
2024-05-03T16:19:33 Z |
vjudge1 |
Trol (COCI19_trol) |
C++14 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll get_range(ll l, ll r) {
l--;
ll a = (l/ 9) * 45;
ll b = (r / 9) * 45;
for (int i = 1; i <= l % 9; i++) a += i;
for (int i = 1; i <= r % 9; i++) b += i;
return b - a;
}
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;
cout << get_range(l,r) << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |