Submission #211885

#TimeUsernameProblemLanguageResultExecution timeMemory
211885aloomyaTrol (COCI19_trol)C++17
50 / 50
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define F first #define S second using PII = pair<int, int>; const int MAX_N = 3e5 + 10, MOD = 1e9 + 7, INF = 3e18, NINF = -3e18; int p[9] = {0, 1, 3, 6, 10, 15, 21, 28, 36}; int sol(int r){ return (r / 9) * 45 + p[r % 9]; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(); int q; cin >> q; for (int i = 0; i < q; i++) { int l, r; cin >> l >> r; cout << sol(r) - sol(l - 1) << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...