最大角度的一个运算的解决,怎么利用C语言的程序的设计的技术来实现的

Problem Description
Do you know the "Happy Farm"? It is a very popular webpage game. The player plays the role of the farmer, who can plant vegetables or grow kinds of flowers at his farm. When vegetables or flowers become ripe, the player can get in them in order to make some money. However, the greatest part of the game is to steal other farmers' vegetables and flowers. The owner of the farm can keep a dog to help him guard against theft. Now, Farmer John intends to steal something when his neighbor David isn't online.
Unfortunately, David keeps a dog. Can you work out a best plan for John?

Let's suppose that David has planted n vegetables. The i-th vegetable's value is vi. Meanwhile, stealing the i-th vegetable increases ai anger value of the dog. Due to the Internet and computer conditions, stealing the i-th vegetable will lead to an initial time delay of di. On the condition that we do not refresh the webpage, if you choose to steal the i-th vegetable in j-th turn, the actual time delay is j * di. Now, John wants to steal all of the vegetables. He can turn the dog's anger value into zero and restart to count the number of delays by refreshing the webpage. Please pay attention that the value of the vegetable you are stealing now must be less than the value of any other vegetable that you have stolen before. It takes r units of time to refresh the webpage and the game allows you to refresh the webpage for m times at most.

During the whole theft, John wants to keep the maximum anger value of the dog at the lowest level. Meanwhile, the total time it takes cannot be longer than t units. Can you work out a plan?

Input
The first line of input contain an integer T (T <= 10), indicating the number of test cases.

Each of the test cases must be organized in the following form. The first line of each case contain four integers n, m, r, t, (1 <= n <= 30000, 1 <= m <= 10, 1 <= r <= 100, 1 <= t <=260), with n representing the number of vegetables, m representing the maximum number for you to refresh the page, r representing the time it takes to refresh the page, and t representing the total time for John to commit his crime.

There must be three integers vi, ai, di, in each of the following n lines.The vi represents the value of each vegetable (just as there are no two same leaves in the world, so are the value of two vegetables).The ai represents the anger value of the dog. And the di represents the initial delay. 0 < vi <= 5*106, 0 < ai <= 100, n * ∑di can't be larger than 262.

Output
The result of the output should be printed in T lines. If there is a solution to the corresponding test case, then print out a positive integer, representing the minimum of the dog's maximum anger value during the whole theft. If John can't steal all the vegetables in the limited time, then the program should print out "I have no idea" in a single line.

Sample Input
3
4 1 1 10
4 2 1
3 2 3
1 2 1
2 2 1
4 0 1 13
4 2 1
3 2 3
1 2 1
2 2 1
4 0 1 14
4 2 1
3 2 3
1 2 1
2 2 1

Sample Output
6
I have no idea
8

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!

相似问题

2
一个数字取模运算的问题,用C语言怎么实现的呢?
1
C语言关于一个运算法则的问题怎么才能解决呢,谢谢
1
C语言四则运算计算器的一个问题
1
如何使用C语言实现逆波兰运算(加减乘除)求值?
1
C语言多项式加减运算(用链表)
1
C语言中如何实现在面积和体积等运算中定义圆周率π?
1
c语言中在运算中如何实现指数运算?
1
C语言多项式加减运算(用链表)?
0
下面这个人数的统计的运算的方式,采用C程序设计怎么解决呢?
2
C++&C 求教再C++中的重载运算符的问题
0
一个大数的四则运算的问题,求出指数的运算结果,采用C语言程序的解决
0
在此题中,气球的颜色的值通过运算获得的方式?采用C语言实现
0
列竖式计算的一个代换问题的算法难题,采用C语言如何运算的
0
线路图的匹配算法问题,逻辑的运算,怎么利用C语言实现这个逻辑
1
求助:c++随机数四则运算10题程序
0
基数进行开平方运算的一个数字问题的求解?用C编程语言如何实现的
0
关于算术运算符和位运算符的一个问题,采用C语言程序的技术来编写程序
0
用竖式计算的一个二进制运算的问题,怎么才能利用C语言的方式的程序来设计
0
32位的整数的运算实现IP地址的算法,C语言的字符数组的运用怎么做
0
根据算法的过程实现密码的解码运算的技术,怎么采用C程序的设计的语言实现