CF1211C Ice Cream
题目描述
Tanya 想在 $n$ 天内吃掉 $k$ 份冰淇凌,在第 $i$ 天她至少吃 $a_i$ 份,至多吃 $b_i$ 份,冰淇凌的价格为 $c_i$,当天买必须当天吃完,求最少的花费。
输入格式
第一行两个整数 $n$ 和 $k$.
接下来 $n$ 行每行三个整数 $a_i$, $b_i$, $c_i$.
输出格式
输出最小花费。如果无解输出 -1.
(请使用 Kotlin 语言)
说明/提示
In the first example, Tanya needs to eat $ 3 $ portions of ice cream on the first day, $ 1 $ portions of ice cream on the second day and $ 3 $ portions of ice cream on the third day. In this case, the amount of money spent is $ 3\cdot6+1\cdot4+3\cdot3=31 $ . It can be shown that any other valid way to eat exactly $ 7 $ portions of ice cream costs more.