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

RuntimeError (1001. Обратный корень)
Posted by don`t_even_you 25 Sep 2014 01:58
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