# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
892078 | kh0i | Trol (COCI19_trol) | C++17 | 1 ms | 348 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.
/**
* author: kh0i
* created: 21.03.2022 11:35:07
**/
#include "bits/stdc++.h"
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif
using ll = long long;
ll sol(ll x){
ll res = 0;
ll k = x / 9;
res += k * 45;
x = x % 9;
for(int i = 1; i <= x; ++i)
res += i;
return res;
}
void solve(){
ll l, r;
cin >> l >> r;
cout << sol(r) - sol(l - 1) << '\n';
}
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(0);
int test = 1;
cin >> test;
for(int i = 1; i <= test; ++i){
solve();
}
cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
return 0;
}
// Write stuff down
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |