Submission #380249

#TimeUsernameProblemLanguageResultExecution timeMemory
380249rqiTrol (COCI19_trol)C++14
50 / 50
1 ms364 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll red(ll a){ if(a % 9 == 0) return 9; return a % 9; } int main(){ int Q; cin >> Q; for(int i = 1; i <= Q; i++){ ll l, r; cin >> l >> r; ll ans = 0; while(l % 9 != (r+1) % 9){ ans+=red(l); l++; } ans+=(r-l+1)/9*45; cout << ans << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...