# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976256 | vjudge1 | Trol (COCI19_trol) | C++17 | 1 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |