|
|
back to boardFailing in test 9 after an hour of realizing how to receive the inputs, here I am failing at test 9. the code looks right to me any ideas? import java.util.*; import java.io.*; public class lucky {
public static void main(String[] args) throws IOException{
BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
double[] ans=new double[64000];
int n=0; StringTokenizer st; while (true) try{
st=new StringTokenizer(cin.readLine()); while (st.hasMoreTokens()){ ans[n]=java.lang.Math.sqrt(Double.parseDouble(st.nextToken()));
n++; } //System.out.println("log");
if (!cin.ready()) throw new Exception();
} catch (Exception ex) {break;}
n--; for(; n>=0; n--) System.out.printf("%.5f\n", ans[n]); }
} Re: Failing in test 9 The input stream is said to be 256KB at maximum, which means it can have 131072 numbers at maximum, if a KB is meant to be 1024 bytes. But you output no more than 64000 numbers. So I assume your program fails on inputs with many numbers. |
|
|