Submission #975619

#TimeUsernameProblemLanguageResultExecution timeMemory
975619vjudge1Trol (COCI19_trol)C++17
50 / 50
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; using ll = unsigned long long; signed main() { int q; cin >> q; while (q--) { ll l, r; cin >> l >> r; ll ans = 0; for (ll i = l; i <= min(r, l + 8LL); i++) { if (i % 9LL == 0) { ans += 9LL * ((r - i) / 9LL) + 9LL; } else { ans += (i % 9LL) * ((r - i) / 9LL) + (i % 9LL); } } cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...