V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  aluo1  ›  全部回复第 5 页 / 共 6 页
回复总数  119
1  2  3  4  5  6  
2015-10-31 15:30:11 +08:00
回复了 webjin 创建的主题 程序员 这道题算法题, python 怎么实现?
def how_many_beer(money):
# The price of the beer
beer_price = 2

# The number of beer bought by the given money
beer_bought = money / beer_price
beer = beer_bought
# Bottle and lid number is the same as the beer bought initially
bottle = beer_bought
lid = beer_bought

# Check whether can trade in more beer
get_more_beer = tradable(bottle, lid)

while get_more_beer:
# Get the trade-in result
on_hand = trade_in(bottle, lid)

# Get the number of trade-in beer
more_beer = on_hand["beer"]
# Beer drunk so far
beer += more_beer
bottle = on_hand["bottle"] + more_beer
lid = on_hand["lid"] + more_beer

get_more_beer = tradable(bottle, lid)

return beer


def tradable(bottle,lid):
# How many bottle can trade in one beer
bottle_to_beer = 4
# How many lid can trade in one beer
lid_to_beer = 2

return (bottle / bottle_to_beer) | (lid/lid_to_beer)

def trade_in(bottle, lid):
# How many bottle can trade in one beer
bottle_to_beer = 4
# How many lid can trade in one beer
lid_to_beer = 2

beer_from_bottle = bottle / bottle_to_beer
beer_from_lid = lid / lid_to_beer
beer = beer_from_bottle + beer_from_lid

remained_bottle = bottle % bottle_to_beer
remained_lid = bottle % lid_to_beer

on_hand = {"beer": beer,
"bottle": remained_bottle,
"lid": remained_lid}

return on_hand

print how_many_beer(10)

应该没错吧。。。求大神指教
2015-10-31 14:59:15 +08:00
回复了 jedihy 创建的主题 Surface surface pro4 使用小感受
@dotpig MS 自家的软件目前适配的还好,但是那些老的没人支持的软件就不行了,简直无解
2015-10-31 12:42:46 +08:00
回复了 ming2281 创建的主题 Surface 在 SurfacePro 上使用 OneNote 的体验?
SP3 用 OneNote 基本能撑一天
笔的话有时候会失灵,有时候会误触
主要是键盘的触摸板简直不能忍,一不小心碰到了鼠标就跑了
2015-10-31 12:41:01 +08:00
回复了 jedihy 创建的主题 Surface surface pro4 使用小感受
@wangsir SP3 i3 乞丐版的开 OneNote 用一天基本没问题, VS 同学实测 i7 版的可以跑一晚上
2015-10-31 12:40:00 +08:00
回复了 jedihy 创建的主题 Surface surface pro4 使用小感受
赞同第 6 点, SP3 下用 Blender 眼睛简直要看瞎
2015-10-31 12:37:16 +08:00
回复了 tracyone 创建的主题 macOS 密码管理哪家强?
@griffinqiu 挺稳当的, WiFi 把密码同步到手机, iPad 上,记不记得都无所谓的

自从网易邮箱事件后,我现在记得起的重要的密码全都改了 - -。
2015-10-27 12:50:45 +08:00
回复了 Gem 创建的主题 macOS 现在 OneNote 好用吗?
@discrete 如果电脑是 Windows 7 的话,千万不要升级 OneNote 2016, 出 bug 了。。。

遇到这么多 bug 简直要哭
2015-10-27 08:59:55 +08:00
回复了 Gem 创建的主题 macOS 现在 OneNote 好用吗?
@discrete 我遇到了好几回,升级之后崩了,再升级修好了,再升级又崩了,导致我好多最近添加的笔记都丢了,就转到 OneNote 了

结果现在 OneNote 2016 在 Windows 7 的台式机上 highlight 盖住了内容而非高亮了,我。。。
2015-10-25 20:45:53 +08:00
回复了 Gem 创建的主题 macOS 现在 OneNote 好用吗?
@discrete Notability 一升级输入中文就崩溃。崩了两三次,投诉了好几次,包括发邮件, MAS 给评价,奈何反应慢,就转到 OneNote 了
2015-10-24 11:43:47 +08:00
回复了 Lily330 创建的主题 前端开发 web 前端小白跪求小项目练手
找一个自己感兴趣的网站,试着自己做出来就好了
2015-10-24 11:41:55 +08:00
回复了 JhonDC 创建的主题 前端开发 一个简单的验证页面,求指导
@Moker +1
2015-10-23 20:09:33 +08:00
回复了 ooh 创建的主题 问与答 怎么我几天没往 bitbucket 上面推代码,今天代码就拉不下来了?
Bitbucket 这两天都有些故障

昨天我 pull 下来也很慢,然后网页打不开,报错
2015-10-23 08:36:40 +08:00
回复了 iciv2ex 创建的主题 MacBook Pro MBP A1278 SSD 配什么好
@iciv2ex 欸。。我是直接拆了原硬盘,没有拆光驱。
2015-10-22 19:31:12 +08:00
回复了 iciv2ex 创建的主题 MacBook Pro MBP A1278 SSD 配什么好
我是从美亚买的三星 840 EVO, 用着还不错
测试可行,网易💊
2015-10-21 18:54:56 +08:00
回复了 aluo1 创建的主题 Windows C# project 如何添加背景音乐
@dong3580 Media Element 可以使用了,谢谢你
2015-10-21 18:54:37 +08:00
回复了 aluo1 创建的主题 Windows C# project 如何添加背景音乐
@longaiwp 刚刚 google 了,谢谢你,已经能够使用了
2015-10-21 18:24:08 +08:00
回复了 aluo1 创建的主题 Windows C# project 如何添加背景音乐
@dong3580 我现在查看 VS, 里面只有一个 Media Element. 然而并不知道怎么用。。。
2015-10-21 18:20:52 +08:00
回复了 flowerains 创建的主题 macOS 新 Magic Keyboard2 入手评测
@edwardaa 我的 2013 款非 Retina 13" 的手感挺好的,我朋友的 2015 年初的 15" Retina 版的键程短了,个人感觉手感变差了
2015-10-21 18:09:03 +08:00
回复了 coolicer 创建的主题 问与答 如果 appleid 用了 163 的,怎么解绑
@coolicer 对的
1  2  3  4  5  6  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3319 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
Developed with CodeLauncher
♥ Do have faith in what you're doing.