摘要: sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030')原文 http://blog.csdn.net/jim7424994/article/details/22675759 阅读全文
posted @ 2017-10-23 23:12 不当咸鱼 阅读(3870) 评论(0) 推荐(0)
摘要: def cakes(recipe, available): d = [False for recipe_key in recipe.keys() if recipe_key not in available.keys()] if d: return 0 else: return min([available[recipe_key]/recipe... 阅读全文
posted @ 2017-10-23 23:11 不当咸鱼 阅读(178) 评论(0) 推荐(0)
摘要: divmod函数:本函数是实现a除以b,然后返回商与余数的元组。 阅读全文
posted @ 2017-10-23 23:08 不当咸鱼 阅读(464) 评论(0) 推荐(0)
摘要: def persistence(n,countSum=0): num = 1 if len(str(n)) !=1: for i in str(n): num = num * int(i) countSum += 1 return persistence(num,countSum=countSum) els... 阅读全文
posted @ 2017-10-23 23:04 不当咸鱼 阅读(279) 评论(0) 推荐(0)
摘要: def get_sum(a,b): if a == b: return a elif a < b: return sum(range(a, b + 1)) else: return sum(range(b, a + 1)) def get_sum(a,b): return sum(xrange(min(a,b),... 阅读全文
posted @ 2017-10-23 23:04 不当咸鱼 阅读(174) 评论(0) 推荐(0)