# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
229215 | VEGAnn | Trol (COCI19_trol) | C++14 | 6 ms | 256 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;
typedef long long ll;
ll ans(ll x){
ll res = x / 9ll * (45ll);
ll ost = x % 9;
for (ll i = 1; i <= ost; i++)
res += i;
return res;
}
int main(){
int qq; cin >> qq;
for (; qq; qq--){
ll l, r;
cin >> l >> r;
cout << ans(r) - ans(l - 1) << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |