ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

( JAVA ), My Code is Running Fine ( See it through for reference ) - Reverse Root
Posted by Gaurav Meena 20 Apr 2020 17:48
import java.util.*;

public class ReverseRoot {
    public static void main(String[] args) {
        ArrayList<Long> list = new ArrayList<>();
        Scanner scn = new Scanner(System.in);
        while (scn.hasNextLong()) {
            long p = scn.nextLong();
            list.add(p);
        }
        scn.close();
        for (int i = list.size() - 1; i >= 0; i--) {
            System.out.printf("%.4f%n", Math.sqrt((double) list.get(i)));
        }
    }
}
Re: ( JAVA ), My Code is Running Fine ( See it through for reference ) - Reverse Root
Posted by Bisqutty 17 Feb 2021 14:58


Edited by author 17.02.2021 15:27
Re: ( JAVA ), My Code is Running Fine ( See it through for reference ) - Reverse Root
Posted by Bisqutty 23 Feb 2021 14:45
Scanner scn = new Scanner(System.in);
        long p;
        String line;

        while (!(line = scn.nextLine()).trim().equals("")) {
            p = Long.parseLong(line);
            list.add(p);
        }