Hướng giải của Mua kẹo
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.

Author: Kokomi

Thuật toán (Tham lam): - Sắp xếp tất cả kẹo theo giá trị tăng dần của ~C~ - Mua kẹo theo giá trị kẹo tăng dần - Kiểm tra nếu vẫn mua được hết tất cả các kẹo có giá trị ~C_i~ thì \(\(S=S-T_i.C_i\)\) - Ngược lại thì mua nhiều nhất có thể các kẹo có giá trị ~C_i~


Nhận xét

Không có ý kiến tại thời điểm này.