Computer Programming Contest Preparation

ToolBox - Source for: 100/10023/a10023.java



/home/toolbox/public_html/solutions/100/10023/a10023.java
    1 import java.util.Scanner;
    2 import java.math.BigInteger;
    3 import java.lang.Math;
    4 
    5 // To submit to UVA (online judge), the class line becomes:
    6 // class Main {
    7 // instead of
    8 // public class axxxx {
    9 
   10 // java 8 does not have a sqrt for biginteger
   11 
   12 
   13 class Main
   14 {
   15     public static void main(String[] args)
   16     {
   17         int num;
   18         BigInteger x;
   19         BigInteger y;
   20 
   21         Scanner sc = new Scanner(System.in);
   22         num = sc.nextInt();
   23         for (int i=0; num>i; i++)
   24             {
   25                 // for each input
   26                 x = sc.nextBigInteger();
   27                 y = x.sqrt();
   28                 System.out.println(y);
   29             } // for each input
   30     }
   31 }
   32 
   33