fork(2) download
  1. import java.util.*;
  2. import java.io.*;
  3. import java.math.*;
  4.  
  5. class Main {
  6.  
  7. public static void main(String[] args) throws IOException{
  8. Scanner sc = new Scanner(System.in);//new File("input.txt"));
  9. PrintWriter pw = new PrintWriter(System.out);//new File("output.txt"));
  10. int n = sc.nextInt();
  11. int x = n;
  12. int m = 0;
  13. while (x > 0)
  14. {
  15. x /= 10;
  16. m++;
  17. }
  18. long ans = (long)n*m + m - 1;
  19. long k = 1;
  20. for (int i = 0; i < m-1; i++)
  21. {
  22. k *= 10;
  23. ans -=k;
  24. }
  25. pw.println(ans);
  26. pw.close();
  27. }
  28. }
  29.  
Runtime error #stdin #stdout #stderr 0.09s 380672KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.util.NoSuchElementException
	at java.util.Scanner.throwFor(Scanner.java:907)
	at java.util.Scanner.next(Scanner.java:1530)
	at java.util.Scanner.nextInt(Scanner.java:2160)
	at java.util.Scanner.nextInt(Scanner.java:2119)
	at Main.main(Main.java:10)