https://ide.codingblocks.com/s/45724
https://hack.codingblocks.com/contests/c/512/1239
2 test cases are wrong!!!
Limited budget party@wrong ans
Hey Ayush, your solution is wrong.
1- it only gives solution to 1st test case.
2- it gives wrong input when last TA is added in the answer, means we need 12 and cost is 1 1 1 4 8, here solution is YES because of 4 and 8… but your solution gives NO.
3- Try to make a function, instead of doing all the work in main function.
https://ide.codingblocks.com/s/45728
now its giving right output for your example too.But still showing wrong ans for 2 test cases
instead of 1 test case, take 2 test cases by taking t = 2 and then run it. you’ll get output for only 1st testcase.
yeah, where is the problem , why it is not running for more than 1 test case. i m not seeing the mistake
Hey Ayush, it is because of your return 0; statement in line no. 20 of your https://ide.codingblocks.com/s/45728 code. Once you use return statement it return from the main() function and no further process takes place.
when i remove that, it is giving more ans than required
Hey Ayush, for that you can use break statement but think on your logic a lil bit more that when to print yes and when you should print no because according to your current code, for each case it will print NO after the for loop is executed.