fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class A
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. int n, m, minus = 1;
  11. n = in.nextInt();
  12. m = 1;
  13. for (int a = 1; n> 0; a *= 10) {
  14. for (int b = a; b < a*10; b++) {
  15. if ((n - minus) < 0) {
  16. System.out.print(0);
  17. return;
  18. }
  19. if ((n - minus) == 0) {
  20. System.out.print(m);
  21. return;
  22. }
  23. n-= minus;
  24. m++;
  25. }
  26. minus++;
  27. }
  28. in.close();
  29. return;
  30. }
  31. }
Success #stdin #stdout 0.06s 2184192KB
stdin
50
stdout
Standard output is empty