首页 > 代码库 > URAL 1001 Reverse Root

URAL 1001 Reverse Root

  • 输入输出优化:直接加BufferedStream
 1 import java.io.BufferedInputStream; 2 import java.io.BufferedOutputStream; 3 import java.io.PrintWriter; 4 import java.util.ArrayList; 5 import java.util.List; 6 import java.util.Scanner; 7   8 public class P1001 9 {10  11     public static void main(String[] args)12     {13         try (Scanner cin = new Scanner(new BufferedInputStream(System.in)))14         {15             List<Double> inputs = new ArrayList<>();16             while (cin.hasNext())17                 inputs.add(cin.nextDouble());18             try (PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out)))19             {20                 for (int i = inputs.size() - 1; i >= 0; i--)21                     writer.println(String.format("%.4f", Math.sqrt(inputs.get(i))));22             }23         }24     }25  26 }

 

URAL 1001 Reverse Root