注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Given R as Number of rooms in a contigious area. 1 < R < 10^8
Given G as Number of goat among some of the R rooms. G <= R
Given P List with Room indexes where goat are. Pi is the index of ith goat in R Rooms. 1<= i <=R
Given E List with Power of each corresponding goat. Ei is the Power of the ith goat. 0 < E < 10^8
Given M as the Max Power You can spend for catching goats.
You can start from any index in P list,
Similarly If you start at 5
at index: 5
3 * (5 - 5) = 0
M left after catching is still 9
at index: 7
2 * (7-5) = 4
M left after catching is 5
at index: 10
1 * (10-5) = 5
M left after catching is 0
Answer will be 3. |