Runtime error in rise and fall of power

Can Someone please tell me what is wrong with my code(http://www.codechef.com/viewsolution/2166308) for the question (http://www.codechef.com/problems/A4)

You cannot use package other than default on CodeChef. And also you are incorrectly reading input, see http://ideone.com/RP4hc2 .

  • For console apps, use a single Scanner to read from System.in.
    Java input classes such as Scanner and BufferedInputStream facilitate fast, nonblocking I/O by buffering an underlying input stream. Programs can create multiple wrappers on an InputStream. Programs that use multiple wrappers around a single input stream, however, can behave unpredictably depending on whether the wrappers allow look-ahead. An attacker can exploit this difference in behavior by, for example, redirecting System.in (from a file) or by using the System.setIn() method to redirect System.in. In general, any input stream that supports nonblocking buffered I/O is susceptible to this form of misuse.

An input stream must not have more than one buffered wrapper. Instead, create and use only one wrapper per input stream, either by passing it as an argument to the methods that need it or by declaring it as a class variable.

4 Likes

I have tried a number of ways to input numbers to a Java program in CodeChef. None of them are working. Can you please explain me the correct way, so that CodeChef accepts my program?