# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
976256 |
2024-05-06T10:59:33 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
600 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int f(int x) {
int ans = x/9;
ans *= 45;
int leftover = x%9;
ans += leftover * (leftover+1)/2;
return ans;
}
void solve() {
int l,r;cin>>l>>r;
cout << f(r) - f(l-1) << endl;
}
int32_t main() {
ios_base::sync_with_stdio(0);cin.tie(NULL);
int t;cin>>t;
while (t--) solve();
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 |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
600 KB |
Output is correct |