fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. // your code goes here
  14.  
  15. Scanner in = new Scanner(System.in);
  16. String s ="";
  17. // int i=0;
  18. String b;
  19. st.setDecimalSeparator('.');
  20. DecimalFormat f = new DecimalFormat("#,####0.0000",st);
  21. while(in.hasNextLong()){
  22.  
  23.  
  24.  
  25. b=in.nextLine();
  26. if(b.contains(" ")){
  27. for(String r:b.split(" ")){
  28. s=r + " " + s;
  29. }
  30. }else{
  31. s = b +" " + s;
  32. }
  33. // i++;
  34.  
  35.  
  36. //System.out.println("i= "+i);
  37. }
  38. if (s.contains("\n")){
  39. s.replace("\n","ups");
  40. }
  41. for(String r:s.split(" ")){
  42. //if(r.contains("\n")){
  43. // System.out.println(r);
  44. System.out.println(f.format(Math.sqrt(Long.valueOf(r))));
  45. // }
  46. }
  47.  
  48. }
  49. }
Success #stdin #stdout 0.15s 321280KB
stdin
1 2 3
4
5
56
6 7 8
stdout
2.8284
2.6458
2.4495
7.4833
2.2361
2.0000
1.7321
1.4142
1.0000