時間限制:C/C++ 3秒,其他語言6秒 空間限制:C/C++ 65536K,其他語言131072K 64bit IO Format: %lld 題目描述 The Wow village is often hit by wind and sand,the sandstorm seriously hindered the economic development of the Wow village. There is a forest in front of the Wowo village, this forest can prevent the invasion of wind and sand. But there is a rule that the number of tallest trees in the forest should be more than half of all trees, so that it can prevent the invasion of wind and sand. Cutting down a tree need to cost a certain amount of money. Different kinds of trees cost different amounts of money. Wow village is also poor. There are n kinds of trees. The number of i-th kind of trees is P_iP i , the height of i-th kind of trees is H_iHi , the cost of cutting down one i-th kind of trees is C_iC i .(Note: “cutting down a tree” means removing the tree from the forest, you can not cut the tree into another height.)
輸入描述: The problem is multiple inputs (no more than 30 groups). For each test case. The first line contines one positive integers n (1 \leq n \leq 10^5)n(1≤n≤10 5 ),the kinds of trees. Then followed n lines with each line three integers H_i (1 \leq H_i \leq 10^9)H i (1≤H i ≤10 9 )-the height of each tree, C_i (1 \leq C_i \leq 200)C i (1≤C i ≤200)-the cost of cutting down each tree, and P_i(1 \leq P_i\leq 10^9)P i(1≤P i≤10 9 )-the number of the tree. 輸出描述: For each test case, you should output the minimum cost. 示例1 輸入 復制 2 5 1 1 1 10 1 2 5 1 2 3 2 3 輸出 復制 1 2