제출 #1259724

#제출 시각아이디문제언어결과실행 시간메모리
1259724krisnandaaaTrol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll pref(ll x){ if(x <= 0) return 0; ll full = x / 9; ll tmp = x % 9; return 45LL * full + (tmp * (tmp + 1)) / 2; } ll simul(ll l, ll r){ return pref(r) - pref(l-1); } int main (){ ios::sync_with_stdio(0); cin.tie(0); int q; cin >> q; while(q--){ ll l,r; cin >> l >> r; cout << simul(l,r) << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...