fork 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 <int>pref;
  7. int main()
  8. {
  9.  
  10. for(ll i = 1; i <1000000001; ++i)
  11. {
  12. ll x= pref[i-1]+(int)(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. scanf("%d%d",&l,&r);
  23. printf("%lld\n", pref[r]-pref[l-1]);
  24. }
  25. return 0;
  26. }
  27.  
  28.  
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty