SWUST OJ 1139: Coin-row problem
题目描述
There is a row of n coins whose values are some positive integers c₁, c₂,...,cn, not necessarily distinct. The goal is to pick up the maximum amount of money subject to the constraint that no two coins adjacent in the initial row can be picked up.
输入
Two lines, the first line is n (0< n <=10000), and the second line is value of coin(0< value <= 2^32).
输出
the maximum amount of money.
样例输入
6
5 1 2 10 6 2
样例输出
17
#include
#include
#include
共有 0 条评论