제출 #975558

#제출 시각아이디문제언어결과실행 시간메모리
975558vjudge1Trol (COCI19_trol)C++17
50 / 50
1 ms392 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; bool bad[105] = {}; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int Q; ll L, R; cin >> Q; while (Q--) { cin >> L >> R; ll ans = (R/9) * 45 + ((R%9) * (R%9 + 1)) / 2; if (L > 1) { L--; ans -= (L/9) * 45 + ((L%9) * (L%9 + 1)) / 2; } cout << ans << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...