I guess since the solution of this task is available anyway, for example, here 
http://acm.timus.ru/help.aspx?topic=scala , it won't hurt to share it. 
import java.util.*; 
public class T1001 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in); //initializing scanner to read data
        long a[] = new long[131072]; //an array to keep the numbers we read
        //Since the input is 256kb at most, in worst case it's 1-digit numbers
        //and spaces only, a bit more than 128k numbers,
        //or 131072 (2^17) to be precise.
        int i = 0; //a counter for amount of numbers we've read
        while (in.hasNextLong()) { //while there's a number of long type yet unread
            i++; //we increase the counter
            a[i] = in.nextLong(); //and read it into our array
        }
        //Here, we've just read all the numbers into an array, using nextLong.
        //It works with spaces AND with line breaks, what you said about it
        //working only for spaces is incorrect.
        for (i = i; i > 0; i--) { //for each number, from last one, to the first one
            System.out.println(Math.sqrt(a[i])); //output the square root for it
        }
    }
} 
Personally though, i prefer this guy's AC code 
http://acm.timus.ru/forum/thread.aspx?id=31547&upd=635564450494489323 , but though it's more optimal, it's kinda harder to explain to a novice. 
Edited by author 18.02.2016 04:41