摘要: 一、分而治之(divide and conquer,D&C) d&c解决问题的两个步骤: 1.找基线条件(最小单位)or(只剩一个或为空); 2.将问题的规模缩小,不断递归直到基线条件; 利用循环求和: 1 def sum(arr): 2 total = 0 3 for i in arr: 4 to 阅读全文
posted @ 2020-04-09 22:57 闪亮可可仙 阅读(249) 评论(0) 推荐(0)
摘要: 一、类 1 class CocaCoca: 2 formula = ['caffeine','sugar','water','soda'] #类的变量(属性) 3 4 coke_for_me = CocaCoca() #类的实例化 5 coke_for_you = CocaCoca() 6 7 pr 阅读全文
posted @ 2020-04-09 14:50 闪亮可可仙 阅读(164) 评论(0) 推荐(0)