Editorial for Bedao Mini Contest 15 - BINGCHILLING
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Ta có thể coi mỗi set Bing Chilling gồm ~x_i + y_i~ chiếc sẽ có giá là ~x_i \times 5~ đồng ~\Rightarrow~ Ta sẽ mua trọn vẹn một số set và mua lẻ một số chiếc Bing Chilling.
Để phải trả ít tiền nhất, ta cần phải cố gắng mua nhiều set Bing Chilling nhất có thể; số set Bing Chilling phải mua sẽ là ~\lfloor \frac{a_i}{x_i+y_i} \rfloor~, phần còn lại ta sẽ mua lẻ.
Cần chú ý, giá mua lẻ ~v~ chiếc Bing Chilling sẽ là ~\min(v,x_i) \times 5~.
Comments