fork 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. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. StringBuilder result = new StringBuilder();
  13. long limit = System.currentTimeMillis() + 4800;
  14. for(int i = 1; i > 0 && System.currentTimeMillis() < limit; i++)
  15. {
  16. String a = String.valueOf(i);
  17. String b = String.valueOf((long) i * i);
  18. if (b.endsWith(a))
  19. {
  20. result.append(a).append("\n");
  21. }
  22. }
  23. System.out.println(result);
  24. }
  25. }
Success #stdin #stdout 4.89s 321024KB
stdin
Standard input is empty
stdout
1
5
6
25
76
376
625
9376
90625
109376
890625
2890625
7109376