Submission #487607

#TimeUsernameProblemLanguageResultExecution timeMemory
487607KazamaHoangTrol (COCI19_trol)C++14
50 / 50
1 ms312 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0)->sync_with_stdio(0); int ntest; for (cin >> ntest; ntest --;) { long long l, r; cin >> l >> r; auto f = [&](long long x) { long long numBlock = x / 9; int rem = x - numBlock * 9; return numBlock * 45 + (rem + 1) * rem / 2; }; cout << f(r) - f(l-1) << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...