when I check my program I get true answer but when I test your on your site I get wrong answer but I don’t know which test my program give wrong result
I spotted two serious problems and two minor problems in your latest program for MARCHA1:
- While reading the notes, if one of the notes equals the requested amount, your program stops reading the input and immediately outputs Yes. This means that the rest of the banknotes is not read for this test case, but will be used when reading the next test case.
- Your program will fail with the following test case: amount 8 with notes 6, 6, 5, 2, 2. Sum will be 21 - 8 = 13. 13 > first 6, so Sum becomes 7. 7 > second 6, so Sum becomes 1. Sum stays 1 when inspecting 5, 2, and 2, so your program concludes that 8 cannot be made using the notes. However, 6 + 2 = 8. You need to do somethng else to find the answer…
The minor problems:
- You malloc an integer array for every test case, but you never free the memory. In general, it is better not to malloc the memory, but statically declare an integer array that can hold the integers n the worst case.
- You use system(“pause”) in the submitted program. I am not sure what the judge will do when this is encountered, but it cannot help…
Another test case:
The answer is yes, but your program prints ‘No’…
Please provide problem and solution link.
What’s the problem code ?..
I believe the latest entry for MARCHA1 (in Partice, easy) was http://www.codechef.com/viewsolution/1492328