ashish_nar's blog

By ashish_nar, history, 7 months ago, In English,

This program is running fine in eclipse but giving me runtime error on test case 4 in codeforces but I am not getting why?

Problem Link :

https://codeforces.com/problemset/problem/1137/B

Program Link :

https://ideone.com/fHQiiH

Please help me to find why codeforces is giving runtime error on test case 4.

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Check out line 28,29 there is a possibility of division by zero So there is a runtime error

  • »
    »
    7 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Hey Thank you very much. and that divide by zero was a problem and I resolved that issue. But now it is giving me wrong answer on test case 6. so I tried all corner cases for the problem and code is working fine for all corner cases. But I don't know maybe I am missing something because of which it is giving me wrong answer. It will be really helpful if you help me out.

    Note : It is giving wrong answer on test case 6.