Submission #205145

#TimeUsernameProblemLanguageResultExecution timeMemory
205145mraronTrol (COCI19_trol)C++14
50 / 50
6 ms380 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int T; cin>>T; while(T--) { ll l,r; cin>>l>>r; ll ans=0; //0 1 2 3 4 5 6 7 8 while(l<=r && l%9!=0) { ans+=(l%9==0?9:l%9); l++; } while(l<=r && r%9!=8) { ans+=(r%9==0?9:r%9); r--; } ans+=(r-l+1)*5; cout<<ans<<"\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...