现有一列随机的正整数,算他有2^n个吧,然后两两结合生成一个二叉树,节点是上一级两个数的和,合成的cost是上一级两个数的乘积。 而整个树的cost由总cost最高的那个branch决定,求用什么方法排列这一列数使生成的树cost最低。
例如,1,2,3,4这四个数
C=21+12=33
| import sys | |
| fout = open(sys.argv[0] + '.mht', 'w') | |
| files = sorted(sys.argv[1:]) | |
| first = True | |
| html_content = '' | |
| attachment_contents = {} | |
| for f in files: | |
| data = open(f, 'r').read() |
| class Cls(object): | |
| def method(self): | |
| return self.__hash__() | |
| obj = Cls() | |
| method = Cls.method | |
| boundMethod = obj.method | |
| print obj.method() | |
| print method(obj) |
| // (function () { | |
| var moduleNames = ['canvas', 'layout'] | |
| , modules = {} | |
| function loadModule() { | |
| var currentModuleName = moduleNames.shift() | |
| , scriptElement = document.createElement('script') | |
| function mod(name) { |
| package net.gerhut.functionaljava; | |
| import java.lang.reflect.Array; | |
| import java.util.Arrays; | |
| public class SimpleList<E> { | |
| public static interface SingleArgFunction<E> { | |
| E apply(E arg); | |
| } |
| /** | |
| * Easing Function f(t) where t, f(t) <- [0, 1] | |
| * return an Easing Factory. | |
| */ | |
| function easing(f) { | |
| /** | |
| * x = f(t) where x <- [x0, x1], t <- [0, t1] | |
| * return an Easing Instance. | |
| */ | |
| return function(x0, x1, t1) { // x = f(t), x <-[x0, x1] |
| logger 自定义格式、输出文件的日志 | |
| csrf 跨站请求保护,需求session | |
| compress gzip压缩 | |
| basicAuth 简单http验证 | |
| json application/json请求体解析到req.body | |
| urlencoded application/x-www-form-urlencoded请求体解析到req.body | |
| multipart multipart/form-data请求体解析到req.body | |
| bodyParser = json + urlencoded + mutipart | |
| timeout 请求超时 | |
| cookieParser cookie解析到req.cookies |
| { | |
| "shell_cmd": "gcc ${file_name} -o ${file_base_name} && ${file_base_name}", | |
| "working_dir": "${file_path}", | |
| "selector": "source.c", | |
| "encoding": "cp936" | |
| } |
Authorization: Basic base64([accountKey]:[accountKey])' %27 after encode"括起来,双引号不知道。