poj3181 Dollar Dayz】的更多相关文章

Description Farmer 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 selling variously for $1, $2, and $3. Farmer John has exactly $5 to spend. He can buy 5 tools at $1…
link:http://poj.org/problem?id=3181 本来很常规的一道完全背包,比较有意思的一点是,结果会超int,更有意思的解决方法是,不用高精度,用两个整型的拼接起来就行了.ORZ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype> #inclu…
Dollar Dayz Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5655   Accepted: 2125 Description Farmer 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 sell…
POJ 3181 Dollar Dayz(全然背包+简单高精度加法) id=3181">http://poj.org/problem?id=3181 题意: 给你K种硬币,每种硬币各自是1美元,2美元-K美元且能够无限使用,问你用上面K种硬币构成n美元的话有多少种方法? 分析: 本题是一道明显的全然背包问题, 只是本题还能够换一种方法来看: 整数n由前K个自然数构造, 一共同拥有多少种方法? (尽管本题要用到高精度加法, 可是非常easy, 不要被吓到哦) 首先是DP部分: 令dp[i][…
Dollar Dayz Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5419   Accepted: 2054 Description Farmer 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 sell…
http://poj.org/problem?id=3181 这个题目一开始就能看出来是个dp问题,但是我并没有一开始就看出来是一个完全背包为题,只是想着根据以前的方法,这个问题应该是可以找到规律的,但是,还是被坑了,这还是一个大数问题! 首先我膜拜一下hankcs大神的: /////////////////////////////////////////////////////////// #include <iostream> using namespace std; unsigned l…
做完这道题,心里五味陈杂,明明是最水的一道题,我却做了最长的时间. 题意是求用1-k的和表示n的方案数. 显然是个计数dp,但我不会.思考半小时未果. 然后找尹鹏哲,他给我讲了个错的dp方程,结果调试半小时未果,看了别人的代码,发现别人虽然滚了一维,但和尹鹏哲讲的十分相似. 后来我又想了想,觉得尹鹏哲的dp方程有点问题,自己改了一下,但当时并没有验证.实际上,由于对题解方程错误理解,当时我已经形成了思维定势,认为方程是对的,却没有发现方程中一个十分微小但十分致命的错误--我把完全背包和01背包的…
http://poj.org/problem?id=3181 Description Farmer 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 selling variously for $1, $2, and $3. Farmer John has exactly $5 to…
Description Farmer 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 selling variously for $1, $2, and $3. Farmer John has exactly $5 to spend. He can buy 5 tools at $1…
http://www.lydsy.com/JudgeOnline/problem.php?id=1655 背包就没什么好说的了,裸的完全背包.. 但是我一开始交开了ull都wa了T_T.. 精度太大... .. 打高精度吧.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algori…