[solved] NZEC in HS08TEST

I am getting NZEC for the solution I submitted for https://www.codechef.com/problems/HS08TEST

My solution:

I tried using try catch and got WA

This means that some line of my code throws exception but I am not sure which line actually throws it. Need help !

Input format is like this
30 120.00
When you use in.readLine() it reads the whole line from input “30 120.00” , so when you use Integer.parseInt it throws an exception as the argument is not an integer. You need to separate the two numbers.
Use something like
String s[]=in.readLine().split(" ");
int withdraw = Integer.parseInt(s[0]);
double balance = Double.parseDouble(s[1]);

Thanks @vbt_95 for helping me out. Your solution worked.


Good wishes from India! :slight_smile:

1 Like

No problem. Good wishes from India too :slight_smile: