Submission #205605

#TimeUsernameProblemLanguageResultExecution timeMemory
205605mayhoubsalehTrol (COCI19_trol)C++14
50 / 50
6 ms376 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define mid (l+r)/2 #define left 2*i+1 #define righ 2*i+2 using namespace std; ll q; ll l,r; ll sum(ll x){ ll ret=(x/9)*45; x%=9; ret+=x*(x+1)/2; return ret; } int main() { cin>>q; while(q--){ cin>>l>>r; cout<<sum(r)-sum(l-1)<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...