解题思路:
两层搜索,用滚动数组可以节省空间。
递归方程:
Floor[Now][site]=Num[site]+Max(Floor[Last][site],Floor[Last][site-1]);
耗时情况:
Test 1: TEST OK [0.011 secs, 1916 KB]
Test 2: TEST OK [0.000 secs, 1916 KB]
Test 3: TEST OK [0.011 secs, 1916 KB]
Test 4: TEST OK [0.011 secs, 1916 KB]
Test 5: TEST OK [0.000 secs, 1916 KB]
Test 6: TEST OK [0.022 secs, 1916 KB]
Test 7: TEST OK [0.011 secs, 1916 KB]
Test 8: TEST OK [0.022 secs, 1916 KB]
Test 9: TEST OK [0.259 secs, 1916 KB]
我的代码:
1 | /* |