# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
968760 |
2024-04-24T03:49:23 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
using namespace std;
long long f(long long x) {
long long ret = (x / 9) * 45;
for (int i = 1; i <= x % 9; i++) ret += i;
return ret;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int Q;
cin >> Q;
while (Q--) {
long long l, r;
cin >> l >> r;
cout << f(r) - f(l - 1) << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 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 |