ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1796. Amusement Park

Key points of the algorithm
Posted by DiG 1 May 2012 20:42
1) First of all you have to calculate maximum of tickets the teacher can buy ((amount of money) div (price of one ticket))
2) Next step you have to find minimum of tickets. You must pick up one banknote with minimum denomination and calculate amount again: in sample test you get 0 1 0 0 0 0 sequence. Then calculate amonut of money again. So, now you can get minimun of tickets ((new amount of money) div (price of one ticket) + 1).
3) So, now you have minimum and maximum of tickets. Just output the number of possible answers in the first line (tMax - tMin + 1) and the variants in ascending order (for i:=tMin to tMax do write(i,' ');

Good luck and get AC!
Re: Key points of the algorithm
Posted by [TDUweAI] daminus 25 Jun 2013 23:54
this algo get WA on test #13

Edited by author 25.06.2013 23:54
Re: Key points of the algorithm
Posted by BillSu 28 Apr 2014 05:59
I think you miss one important step: Think hard about how flexible your tickets is. Not just minimum and maximum tickets, otherwise you will still get WA.
Re: Key points of the algorithm
Posted by miro.v.k 24 Apr 2016 23:20
Thank you :) !