fork(3) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static int mknum(int n)
  11. {
  12. if (n == 0) return 1;
  13. else return (int)Math.pow((double)10, (double)((int)Math.log10((double)n) - 0));
  14. }
  15. static int f(int n, int seed)
  16. {
  17. if (n == 0) return seed / 10;
  18. return f(n % mknum(n), n / mknum(n) * mknum(seed) * 10 + seed);
  19. }
  20. public static void main (String[] args) throws java.lang.Exception
  21. {
  22. // your code goes here
  23. System.out.println(f(12345678, 0));
  24. }
  25. }
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
87654321