上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 39 下一页
摘要: 找钱问题描述:与背包问题不同,找钱问题是结果必须是把容量全部装满一.用的钱的最大最小数目把空间开大,所需求的dp值只是其中的一种特殊情况而已1.01背包模型,每种货币只能用一次最小求法#include#include#includeusing namespace std;int dp[50000],... 阅读全文
posted @ 2015-05-01 16:06 Painting、时光 阅读(341) 评论(0) 推荐(0) 编辑
摘要: DescriptionFarmer John has gone to town to buy some farm supplies. Being a very efficient man, he always pays for his goods in such a way that the sma... 阅读全文
posted @ 2015-05-01 14:41 Painting、时光 阅读(178) 评论(0) 推荐(0) 编辑
摘要: DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from... 阅读全文
posted @ 2015-04-30 19:47 Painting、时光 阅读(216) 评论(0) 推荐(0) 编辑
摘要: DescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a lot and so he often buys coffee at coffee vending machines at motores... 阅读全文
posted @ 2015-04-29 21:32 Painting、时光 阅读(175) 评论(0) 推荐(0) 编辑
摘要: DescriptionFarmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are ... 阅读全文
posted @ 2015-04-29 18:31 Painting、时光 阅读(159) 评论(0) 推荐(0) 编辑
摘要: DescriptionNew Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5c coins. Write a program that will determ... 阅读全文
posted @ 2015-04-28 21:35 Painting、时光 阅读(155) 评论(0) 推荐(0) 编辑
摘要: DescriptionSuppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amo... 阅读全文
posted @ 2015-04-28 20:40 Painting、时光 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Problem Description小明误入迷宫,塞翁失马焉知非福,原来在迷宫中还藏着一些财宝,小明想获得所有的财宝并离开迷宫。因为小明还是学生,还有家庭作业要做,所以他想尽快获得所有财宝并离开迷宫。Input有多组测试数据。每组数据第一行给出两个正整数n,m(0#include#include#... 阅读全文
posted @ 2015-04-28 19:40 Painting、时光 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 算法大意:从一个起点出发,到达所有需要达到的点,再回到本身,求最短路法一:用状态压缩思想#include#include#include#includeusing namespace std;int n;struct edge{ int x; int y;}a[20];int temp[... 阅读全文
posted @ 2015-04-28 15:30 Painting、时光 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 1.数组模拟链表实现struct edge{ int u,v,w,next;}a[MAX];int E,u,v,w;E = 0;memset(head,-1,sizeof(head));void add(int u,int v,int w){ a[E].u = u;a[E].v = v;... 阅读全文
posted @ 2015-04-28 13:25 Painting、时光 阅读(182) 评论(0) 推荐(0) 编辑
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 39 下一页