Submission #251504

#TimeUsernameProblemLanguageResultExecution timeMemory
251504MrRobot_28Trol (COCI19_trol)C++17
50 / 50
1 ms384 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int q; cin >> q; while(q--) { int l, r; cin >> l >> r; int sum = 0; sum += 45 * (r / 9); while(r % 9 != 0) { sum += r % 9; r--; } l--; sum -= 45 * (l / 9); while(l % 9 != 0) { sum -= l % 9; l--; } cout << sum << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...