由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 贡献个面试题,目前狗狗都没找到.....
相关主题
问一道 Interviewstreet 上的题 (JAVA)一道面试题:三等分数组
求教EA一道面试题算法面试题
面试题求解讨论一道面试题
Help...leetcode divide two integers一个面试题
Amazon面试题的疑惑,5个包子答谢!也来一道Flag面试题
请教电面试题最近onsite的时候刚拿到一道面试题?
一个面试题帮我看下这是份什么工作,不是骗钱的吧?
面试题总结(5) - Binary search and divide and conquer我也来贡献一下亚马的题
相关话题的讨论汇总
话题: robot话题: task话题: tasks话题: seconds话题: input
进入JobHunting版参与讨论
1 (共1页)
i********x
发帖数: 2
1
You are given a list of tasks as an integer array, task_costs. Every i-th
element of task_costs represents a task and requires task_costs[i] seconds
to complete. All tasks listed in the array are independent of other tasks.
It is required to finish all the tasks independently and as soon as possible
. You are given a single worker robot to start taking the tasks and finish
them one at a time. However if you like, you can divide the worker robot in
two. Each resulting robot can then be further divided into two and so on.
There is a cost, in seconds, of dividing a robot in two, represented by
robot_divide_cost.
You can assign an independent task to any available robot, however you can't
interrupt or divide a robot while it is working on the assigned task. At
the same time you can't assign a task to any robot while its in the process
of getting divided.
To keep things simple you can't allow multiple robots to work on the same
task. At any given time only one robot can work on a task and finish it.
Once any particular robot finishes a task it can't be assigned any further
tasks.
Given a list of tasks and cost of dividing a robot, find the least amount of
time to finish all tasks.
Constraints
1 <= tasks <= 50
1 <= seconds required to complete a single task <= 3600
1 <= robot_divide_cost <= 3600
Input Format
Line 1: comma separated list of integers representing task_costs array
Line 2: robot_divide_cost
Output Format
Line 1: minimal cost required to complete all tasks
Sample Input
2000,200,20,2
2
Sample Output
2002
Explanation
One possible way to finish all tasks in minimal time would be as follows:
We start with one robot and immediately split the robot in two (robot_A &
robot_B) to start working on task 1 and task 2. Since the cost of dividing
the robot is 2 seconds, we will have two robots working on first two tasks
after 2 seconds. After 202 seconds from the start, robot_B will be finished
and can be split again.
We split robot_B consuming another 2 seconds. At 204 seconds from start we
get robot_C and immediately assign task 3 to robot_C. However we can't use
robot_B again as it has already finished one task and have to split it again
to get robot_D. At 206 seconds from start we get robot_D and assign it task
4.
还给了2个test case:
Input:
1712,1911,1703,1610,1697,1612
100
Expected Output: 2012
Input:
3051,1861,3101,2156,2297
3465
Expected Output: 12551
Q**F
发帖数: 995
2
问个问题。
为什么b不直接同时分解成c和d,而要等分出c之后再分出d
b*****l
发帖数: 17
3
也可以吧,但其实结果还是一样的
z*********n
发帖数: 1451
4
这题感觉就是要生成不同叶子节点高度的二叉树,找一个最能匹配tasks的一组。
但是俺不知道怎么高效生成不同叶子节点高度的二叉树。。。
j**********3
发帖数: 3211
5
这么长的题目,我一看就晕了
1 (共1页)
进入JobHunting版参与讨论
相关主题
我也来贡献一下亚马的题Amazon面试题的疑惑,5个包子答谢!
MathWorks 面经请教电面试题
any open source project for this problem?一个面试题
fb国内申请的曲折经历+电面面试题总结(5) - Binary search and divide and conquer
问一道 Interviewstreet 上的题 (JAVA)一道面试题:三等分数组
求教EA一道面试题算法面试题
面试题求解讨论一道面试题
Help...leetcode divide two integers一个面试题
相关话题的讨论汇总
话题: robot话题: task话题: tasks话题: seconds话题: input