1
justfly OP |
2
justfly OP |
3
justfly OP |
4
justfly OP |
5
justfly OP 我实在是不会用v2ex的gist了 gist地址在此 对题目有兴趣自己看吧:
第一题答案:https://gist.github.com/imjustfly/56bec176509c5bb3ff16 第二题第一种方法:https://gist.github.com/imjustfly/488998c7410e31a56072 第二题第二种方法:https://gist.github.com/imjustfly/348d352d6127cd2cbcc1 |
6
justfly OP |
7
polythene 2013-04-12 17:44:22 +08:00
第一题是个典型的动态规划问题,可以网上搜下,很普遍的。
同求:怎样贴gist??? |
8
Xrong 2013-04-12 17:46:29 +08:00
第一题:不知道理解有木有错,楼主方便把运算结果贴下么?木有Python环境
function getit($n) { $biggest = $n; $multiple = floor($n / 3); $left = $n % 3; if ($multiple == 0) { return $biggest; } else { for ($i=0; $i<$multiple; $i++) { $temp = ($left + 3 * $i) * pow(2, ($n - $left - 3 * $i) / 3); $biggest = $temp > $biggest ? $temp: $biggest; } return $biggest; } } for ($i=1; $i<20; $i++) { echo "Input is $i: Output is: ", getit($i); echo "<br>"; } 我的运算结果: Input is 1: Output is: 1 Input is 2: Output is: 2 Input is 3: Output is: 3 Input is 4: Output is: 4 Input is 5: Output is: 5 Input is 6: Output is: 6 Input is 7: Output is: 8 Input is 8: Output is: 10 Input is 9: Output is: 12 Input is 10: Output is: 16 Input is 11: Output is: 20 Input is 12: Output is: 24 Input is 13: Output is: 32 Input is 14: Output is: 40 Input is 15: Output is: 48 Input is 16: Output is: 64 Input is 17: Output is: 80 Input is 18: Output is: 96 Input is 19: Output is: 128 Input is 20: Output is: 160 Input is 21: Output is: 192 Input is 22: Output is: 256 Input is 23: Output is: 320 Input is 24: Output is: 384 Input is 25: Output is: 512 Input is 26: Output is: 640 Input is 27: Output is: 768 Input is 28: Output is: 1024 Input is 29: Output is: 1280 |
9
Xrong 2013-04-12 18:01:59 +08:00
做错了...
|
10
lin 2013-04-12 20:07:41 +08:00
把 https 改成 http 试试
|
11
xidianlz 2013-05-16 13:31:07 +08:00
我想知道第二题的
1.这些用户每天都会访问(GET)/topic/***这个路径两次以上(*代表数字) 2.这些用户每天访问(GET)的/topic/***路径中,至少会包含两个不同的路径(后面的数字不一样) 这两个条件有啥不一样?第二个条件不是包含第一个么? |