# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
975137 |
2024-05-04T13:28:26 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
600 KB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int q; cin >> q;
while(q--){
ll l, r; cin >> l >> r;
ll ansR = 0;
ansR += (r/9) * 45;
for(int i = 1; i <= r % 9; i++){
ansR += i;
}
ll ansL = 0;
ansL += ((l-1)/9) * 45;
for(int i = 1; i <= (l-1) % 9; i++){
ansL += i;
}
cout << ansR - ansL << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
600 KB |
Output is correct |