Submission #1249350

#TimeUsernameProblemLanguageResultExecution timeMemory
1249350amawTrol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long q; cin >> q; while(q--) { long long x, y; cin >> x >> y; x--; long long sumHigh = 0, sumLow = 0; for (int i = 1; i <= y % 9; i++) sumHigh += i; for (int i = 1; i <= x % 9; i++) sumLow += i; long long ans = (45 * (y / 9) + sumHigh) - (45 * (x / 9) + sumLow); cout << ans << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...