2013年2月13日

Function Run Fun(简单)

摘要: Function Run FunTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 13734Accepted: 7154DescriptionWe all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c):if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns:1if a > 20 or b > 20 or c > 20 阅读全文

posted @ 2013-02-13 23:49 铁树银花 阅读(1744) 评论(0) 推荐(0) 编辑

The Triangle(DP基础)

摘要: The TriangleTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 31614Accepted: 18667Description73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends so... 阅读全文

posted @ 2013-02-13 22:27 铁树银花 阅读(324) 评论(0) 推荐(0) 编辑

01背包

摘要: 问题描述: 有N件物品和一个载重量为C的背包。第i件物品的重量是w[i],价值是v[i]。求解将哪些物品装入背包可使这些物品的重量总和不超过背包容量,且价值总和最大。问题特点: 每种物品仅有一件,可以选择放或不放。(0:不放 1:放)基本思路: 用p[i][j]表示前i件物品放入一个容量为j的背包中可以获得的最大价值。得到如下关系: 1.p[i][0] = p[0][j] = 0 ··········· (1) 2.p[i][j] = p[i - 1][j] (当j < w[i] 阅读全文

posted @ 2013-02-13 17:06 铁树银花 阅读(181) 评论(0) 推荐(0) 编辑

导航