由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - nuts in an osis
相关主题
问道很难的面世题transport car to another state (转载)
再来一个brainteaser有没有最近面试google的,面试有变化吗
Bloomberg phone interview (intern)Mobile Packet Core position
bb面试的25批马问题一道电话题
问一道Brain Teaser题我撕去一小块窗纸,你能看到多远的天?
求cisco面经(二面)EE转行面google怎么填Technical skills?
一个经典的GOOGLE 面试题目, 怎么回答才是最完整的。Cisco vs A家, 请大家指教。
Google点面FLAG干货:
相关话题的讨论汇总
话题: nuts话题: pile话题: cart话题: horse话题: rounds
进入JobHunting版参与讨论
1 (共1页)
P********l
发帖数: 452
1
Could not find the old post, so open a new one. But the answer to this
question seems very simple.
Suppose the pile of nuts can let the cart go back and forth R rounds:
C-D*F + R*(C-2*D*F) <= N
R = floor((N - (C-D*F))/(C-2*D*F))
Then X = max( R rounds, R+1 rounds).
Correct?
================
A pile of nuts is in an oasis, across a desert from a town. The pile
contains 'N' kg of nuts, and the town is 'D' kilometers away from the pile.
The goal of this problem is to write a program that will compute 'X', the
maximum amount of nuts that can be transported to the town.
The nuts are transported by a horse drawn cart that is initially next to the
pile of nuts. The cart can carry at most 'C' kilograms of nuts at any one
time. The horse uses the nuts that it is carrying as fuel. It consumes 'F'
kilograms of nuts per kilometer traveled regardless of how much weight it is
carrying in the cart. The horse can load and unload the cart without using
up any nuts.
Your program should have a function that takes as input 4 real numbers D,N,F
,C and returns one real number: 'X'
1 (共1页)
进入JobHunting版参与讨论
相关主题
FLAG干货:问一道Brain Teaser题
[BSSD]我来说说最近面人的经历吧求cisco面经(二面)
Sr. Sales Engineer(Network Security) Opening-Santa Clara一个经典的GOOGLE 面试题目, 怎么回答才是最完整的。
分享一些Presentation的心得Google点面
问道很难的面世题transport car to another state (转载)
再来一个brainteaser有没有最近面试google的,面试有变化吗
Bloomberg phone interview (intern)Mobile Packet Core position
bb面试的25批马问题一道电话题
相关话题的讨论汇总
话题: nuts话题: pile话题: cart话题: horse话题: rounds