|
|
back to boardwhat's wrong with my implementation (java) import java.util.*; import java.io.*; public class p1001 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> nums = new ArrayList<String>(); String line; while (true) { line = br.readLine(); if (line == null) break; StringTokenizer st = new StringTokenizer(line); while (st.hasMoreTokens()) { nums.add(st.nextToken()); } }
for (int i = nums.size() - 1; i >= 0; i--) { int num = Integer.parseInt(nums.get(i)); System.out.printf("%.4f\n", Math.sqrt(num)); } } } Re: what's wrong with my implementation (java) Posted by Gary 14 Dec 2013 16:04 you did not account for the max size limit on the input.... |
|
|