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

Failing in test 9
Posted by Iman Akbari 1 Jul 2013 14:23
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
Posted by BigProgrammer 15 Jul 2013 18:30
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.