|
|
вернуться в форумJava. Test 4. Error public static void main(String[] args) throws Exception {
in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = null;
List<Long> listLong = new ArrayList<Long>(); while (true) { try { listLong.add(readLong()); if (!in.ready()) { throw new Exception(); } } catch(Exception ex) { break; } } for (int i = listLong.size() - 1; i >= 0; i--) { Double dbl = (double)listLong.get(i); BigDecimal bigDecimal = new BigDecimal(Math.sqrt(dbl)); bigDecimal = bigDecimal.setScale(4, BigDecimal.ROUND_HALF_UP); out.println(bigDecimal.toPlainString()); } out.flush(); } It fails on a test №4. Does somebody know why? Re: Java. Test 4. Error public class Main { public static void main(String[] args){
Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); ArrayList<Long> l=new ArrayList<Long>(); try{ while(in.hasNext()){ l.add(in.nextLong()); } } catch(Exception e){} finally{ in.close(); }
} } maybe use,correct read? Long type |
|
|