# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974833 |
2024-05-03T22:17:00 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
int sembilan[] = {9, 1, 2, 3, 4, 5, 6, 7, 8};
int q;
ll l, r;
int toDigit(ll i) {
return sembilan[i%9];
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(nullptr);
cin >> q;
while(q--) {
cin >> l >> r;
ll ans = 0;
ans += ((r-l)/9)*45;
r = ((r-l)%9)+l;
for(ll i = l;i <= r; i++) {
ans += toDigit(i);
}
cout << ans << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 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 |