fork(1) download
  1. # include <iostream>
  2. # include <cmath>
  3. # include <iomanip>
  4. # include <fstream>
  5. using namespace std;
  6. int main()
  7. {
  8. int n = 16;
  9. int limit = 10;
  10. int step = 1;
  11. int total = 0;
  12. for ( int i = 1; i<=n ;++i ){
  13. if (i==limit){
  14. limit*=10;
  15. step+=1;
  16. }
  17. total += step;
  18. }
  19. cout << total << endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
23