Submission #221128

#TimeUsernameProblemLanguageResultExecution timeMemory
221128eohomegrownappsTrol (COCI19_trol)C++14
50 / 50
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> pref; ll suminc(ll x){ if (x==0){ return 0; } return pref[9]*(x/9)+pref[(x%9)]; } int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int q; cin>>q; pref.resize(10,0); for (int i = 1; i<=9; i++){ pref[i]=pref[i-1]+i; } for (int i = 0; i<q; i++){ ll l,r; cin>>l>>r; cout<<(suminc(r)-suminc(l-1))<<'\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...