fork(2) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define mod 1000000007
  4. #define ll long long int
  5. using namespace std;
  6. vector <ll>pref;
  7. int main()
  8. {
  9. pref[0]=0;
  10. for(ll i = 1; i <1000000001; ++i)
  11. {
  12. ll x= pref[i-1]+(ll)(log10(i)+1)*i;
  13. pref.push_back(x);
  14. }
  15.  
  16. ll l,r;
  17. ll t;
  18. cin>>t;
  19.  
  20. while(t--)
  21. {
  22. cin>>l>>r;
  23. cout<<pref[r]-pref[l-1];
  24. }
  25. return 0;
  26. }
  27.  
  28.  
Runtime error #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty