|
|
back to boardRuntimeError (1001. Обратный корень) import java.util.*; import java.text.*; public class Test{ public static void main(String args[]){ Scanner in = new Scanner(System.in);
String s;
s = in.nextLine();
char c;
int i = 0;
Double [] mass = new Double [256];
String st = "";
for(int j = 0; j < s.length(); j++){ c = s.charAt(j);
if(c == ' ' || j == s.length() - 1){ //реализация вывода корня mass[255 - i] = Double.valueOf(st);
i++;
st = ""; }
if(c != ' ') st += c; }
DecimalFormatSymbols symbol = new DecimalFormatSymbols(); symbol.setDecimalSeparator('.'); DecimalFormat f = new DecimalFormat("#,##0.0000", symbol);
for(Double d: mass){ if(d != null){ System.out.println(f.format(Math.sqrt(d))); }
} } } Edited by author 25.09.2014 02:00 |
|
|