有n个点排成一行,每两个点有一个权值。现在你可以从任何一个点出发,去遍历其他点,每经过两个相邻点之间的边,边的权值就会减1,求最多能走的步数用两个dp数组记录往左走和往右走的最大步数dp1[i][0]表示从i往左走最多能走的步数dp1[i][1]表示往左走并回到i最多能走的步数dp2同理然后遍历一遍就可得答案View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn = 100010;long long num[maxn];l Read More
posted @ 2012-07-01 02:25 Because Of You Views(595) Comments(0) Diggs(0) Edit