|
|
back to board1001. Обратный корень(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 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 |
|
|