Submission #256862

#TimeUsernameProblemLanguageResultExecution timeMemory
256862dolijanTrol (COCI19_trol)C++14
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> typedef long long ll; #define pb push_back; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int q; cin>>q; while(q--) { ll l,r; cin>>l>>r; ll k=l; ll suma=0; while(k%9!=0 && k<=r) { suma+=(k%9); k++; } //cout<<suma<<endl; ll m=r; while(m>=k && m%9!=0) { suma+=(m%9); m--; } /*cout<<suma<<endl; cout<<m<<" "<<k<<endl;*/ if(m%9==0) suma+=9; cout<<((m-k)/9)*45+suma<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...