Problem in program

i am having problem in a program the compiler is showing that the program is executed successfully
and the output to question is also correct but the submission queue is showing it has a run time error pleaze help …
the code is:
PROBLEM CODE:COPS
https://www.codechef.com/viewsolution/28407439

Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

ahh i dont know how to do it plz tell me

Don’t know how to do what?

Anyway, assuming this is the Submission you were trying to link to, consider the testcase:

1                                                       
5 10 5

ahh…its showing 0

Really? For me, it’s showing:

0
0

i have corrected it…bt still its showing error

Good - please link to your most recent submission in future - I’ll do it for you, for now :slight_smile:

https://www.codechef.com/viewsolution/28373868

Now, consider the testcase:

1
4 5 2
1 Like

its showing 1

plz help

Yes - is that the correct answer?

Edit:

And that’s not a link to your Submission! This is, though.

its showing wrong answer
my bad,sorry

Yes, I know - I’ve given you a testcase: is your program giving the correct answer for that testcase, and if not, what is the correct answer, and how do you fix your program so that it does give the correct answer for that testcase?

its giving the correct answer

Really? If I have 4 apples and 5 oranges, and can buy two apples/ oranges, the minimum difference between the number of apples and oranges I can obtain is 1?

my bad sorry
i really interpreted it wrong…
and thanks for ur time

1 Like

Ah, no problem - it happens :slight_smile:

After you’ve fixed that, consider the testcase:

1                 
1 100 1
1 Like

thanks a lot sir…
finally i got it

1 Like