Problem Description
Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make it indist...
分类:
其他好文 时间:
2014-08-15 17:54:39
阅读次数:
322
题意:有5中货币,价值分别为 50-cent, 25-cent, 10-cent, 5-cent,1-cent,数量都为无限个,
给定一个数 n,求用上述货币组成价值为 n 的方法有多少?
分析:因为n母函数 或 dp 打表
对于dp状态方程为: dp[j]+=dp[j-c[i]]
#include
int c1[7500],c2[7500],w[5...
分类:
其他好文 时间:
2014-08-08 18:19:26
阅读次数:
261
高中概率的几何概型,这也叫作题,不过输出真的很坑。
题目大意:
n*m个边长为t的正方形组成的矩形。往矩形上抛一个直径为c的硬币,问覆盖1,2,3,4个矩形的概率为多少?
解题思路:
计算出覆盖1,2,3,4个矩形时硬币圆心可以在的位置区域。就能求出概率了~
下面是代码:
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2014-08-08 12:55:25
阅读次数:
180
题意:你有N种硬币,每种价值A[i],每种数量C[i],问。在不超过M的情况下,我们用这些硬币,付款有多少种情况。也就是:1,2,3,4,5,....,M这么多种情况下,你能用你的硬币不找钱,付款多少种情况。
例如:
你有一种硬币,价值2,个数2,那么 你是不能付款 3元的。。你只能付款2,或者4元。。
OK,题意差不多就是这样啦。
那么这里有两种方式!
分析:
那么这里我们可以用多重...
分类:
其他好文 时间:
2014-08-07 15:56:00
阅读次数:
374
题目:uva674 - Coin Change(完全背包)
题目大意:给1 5 10 25 50 这5中面值的硬币,然后给出N,问用这些钱组成N的不同方式数目。1 5 和 5 1 表示同一中,顺序不同算相同。
解题思路:完全背包。 状态方程:dp【j】 += dp【 j - v【i】】;
代码:
#include
#include
const int N = ...
分类:
其他好文 时间:
2014-08-03 20:39:55
阅读次数:
219
题意:用所给的硬币面值构成所需的面值
思路:因为所用硬币数量不限,所以很容易想到完全背包。
递推:
#include
#include
#include
#include
using namespace std;
const int MAXN = 10005;
int n;
int coin[] = {1, 5, 10, 25, 50};
long long d...
分类:
其他好文 时间:
2014-07-29 15:02:39
阅读次数:
214
很灵活的题目,题意简单,看到又是钱币问题,类似于那种给了一定数目T,有n种钱币,每种的价值,让你组合成总价值为T的方案数,但是加了一些限制条件,那就是某些种类钱币数量必须大于另一些种类的,加了个限制条件 我就脑残了,唉智商看来是真不够啊 ,后来看了别人的分析
倘若种类a的钱币数量必须要大于种类b的数量,那么如果我要 去 m张b种类的钱币,其实同时也是相当于已经取了m张a种类的,因为a必须大于b的...
分类:
其他好文 时间:
2014-07-29 14:34:58
阅读次数:
295
Coin Toss
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 3019
Accepted: 817
Description
In a popular carnival game, a coin is tossed onto a table with a...
分类:
其他好文 时间:
2014-07-28 15:54:53
阅读次数:
418
Coin Change
Suppose 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 amount of money.
For example, if ...
分类:
其他好文 时间:
2014-07-10 21:12:39
阅读次数:
158
Daizhenyang's Coin
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 320 Accepted Submission(s): 146
Problem Description
We know that...
分类:
其他好文 时间:
2014-07-08 17:58:15
阅读次数:
251