Look at this bit again.
what’s wrong in that with 0 0 as input the program will end. Btw i also made it as while(budget!=0 || n!=0),still it’s giving wrong answer. Where i am going wrong. Enlighten me
I was thinking of test cases like
20 0
and
0 1 1 1
Try this then:
25 10 24 5 11 4 22 9 23 6 6 5 18 9 16 9 16 2 15 8 24 0
I got the answer as 24 14 and i think it should be correct. Am i wrong? What is the correct answer for this case?
According to my program 6 5 18 9, should be selected.
And the party below 18 9 is?
Then how should i calculate the sum of entrance fees? Any suggestions.
Debug the code, find out where it goes wrong, then correct it.
As we’ve seen, you need to consider parties that provide the same fun, but at a cheaper price.
20 10 16 9 12 8 12 4 11 3 19 5 7 1 6 1 13 0 13 7 10 3
18 9 is my answer. What’s wrong in that now?
This party exists
16 9
Same fun, cheaper price.
Now i changed my logic and it got accepted now. Thanks for your support.
Yay!