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

1001. Обратный корень(Wrong answer) Java
Posted by Сергей 4 Apr 2015 17:02
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Scanner;


public class Task1001
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Long> list = new ArrayList<Long>();
        for (int i = 0; i < 4 ; i++)
        {
            long a = scanner.nextLong();
            if (a >= 0 && a <= 10E18)
            list.add(a);
        }
        DecimalFormatSymbols symbol = new DecimalFormatSymbols();
        symbol.setDecimalSeparator('.');
        DecimalFormat f = new DecimalFormat("#,##0.0000", symbol);

        for (int i = list.size(); i > 0 ; i--)
        {
            double c = (Math.sqrt(list.get(i - 1)));
            System.out.println((f.format(c)));
        }
    }
}



I need help please!!!

Edited by author 04.04.2015 17:02
Re: 1001. Обратный корень(Wrong answer) Java
Posted by Pranav Bhartia 5 Jun 2015 12:49
Well, maybe because you are checking it only for 4 Long values, It's working only for 4 exact values, not less, not more.


Edited by author 05.06.2015 13:04