fork(4) download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n = 3;
  7. int i = 10;
  8. int res = 0;
  9. while(i < n){
  10. res += (i - i/10)*log10(i);
  11. i *= 10;
  12. }
  13. res += (n - i/10)*log10(i)+ceil(log10(n));
  14. cout<<res;
  15. return 0;
  16. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
3