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

WA in JAVA - Why?
Posted by Kirill 22 Jan 2016 13:26
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.*;

public class Try2 {

    public static void main(String[] args)
    {
        DecimalFormatSymbols s = new DecimalFormatSymbols();
        s.setDecimalSeparator('.');
        DecimalFormat f = new DecimalFormat("#,####0.0000",s);
        Scanner in = new Scanner(System.in);
        while (in.hasNextLong())
        {
        System.out.println(f.format(Math.sqrt(in.nextLong()) ));
        }
    }
}
Re: WA in JAVA - Why?
Posted by ToadMonster 22 Jan 2016 14:32
Task:
> For each number Ai from the last one till the first one ...

So, did you try to check your solution on sample? Did you notice that numbers in your answer are in the wrong order?
Re: WA in JAVA - Why?
Posted by Kirill 22 Jan 2016 14:44
oh, thanks!
Re: WA in JAVA - Why?
Posted by JavaClass 17 Feb 2016 00:19
So, did You solve this problem with sqrt in wrong order? If
You did, explain how?