poj2063 Investment(多次完全背包)】的更多相关文章

http://poj.org/problem?id=2063 多次完全背包~ #include <stdio.h> #include <string.h> #define MAXN 50000 #define max(a,b) ((a)>(b)?(a):(b)) int dp[MAXN]; int v[11], c[11]; int main() { int t, m, year, d, i, j, k, sum; scanf("%d", &t);…
Investment Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8019   Accepted: 2747 Description John never knew he had a grand-uncle, until he received the notary's letter. He learned that his late grand-uncle had gathered a lot of money, s…
http://poj.org/problem?id=2063 首先总结一下:总的来说通过这题我深深感觉到了自己的不足,比赛时思维很受限,...面对超时,没有想到好的解决方案. 题意:给出初始资金,还有年数,然后给出每个物品的购买价格与每年获得的利益,要求在给出的年份后所能得到的最大本利之和. 思路:因为每种物品可以多次购买,可以看做是完全背包的题目,但是要注意的是,由于本金可能会很大,所以我们要对背包的大小进行压缩,(否则超时超内存)值得注意的是,题目已经说了本金与物品的购买价格都是1000的倍…
题目链接: http://poj.org/problem?id=2063 题意: 你现在有现金m元,你要做n年的存款投资,给你k种投资方式,每种需要现金vi元,能获得xi元的理论,一年到期后你要利用拿到的本息和重新投资,问这样做n年最后能拿到的最大本息和是多少. 题解: dp[i]表示你花i元去投资能获得的最大利润. 则第一年你要做的就是dp[1]->dp[m](m为初始金额) 假设获得的最大奖金为m_inte[i]: 则第二年要做的是dp[m+1]->dp[m+m_inte[i]] ...…
图论 图论解题报告索引 DFS poj1321 - 棋盘问题 poj1416 - Shredding Company poj2676 - Sudoku poj2488 - A Knight's Journey poj1724 - ROADS(邻接表+DFS) BFS poj3278 - Catch That Cow(空间BFS) poj2251 - Dungeon Master(空间BFS) poj3414 - Pots poj1915 - Knight Moves poj3126 - Prim…
Problem Description John never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only inheritor. John did not need tha…
题目链接:http://poj.org/problem?id=2063 今天果然是卡题的一天.白天被hdu那道01背包的变形卡到现在还没想通就不说了,然后晚上又被这道有个不大也不小的坑的完全背包卡了好久.这题主要是说让你选择不同的债券(每种债券的费用和年利率的属性),然后n年后使得本金最大,如果仅仅是问一年的话就是个裸完全背包的题了,不过它是n年,每年得到的总利息都会加入到本金中变为下一年的本金,知道了这个后就很好处理了,在这道题里每年变化的本金就是背包容量,然后债券那两个属性就是物品的费用(o…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1963 //多重背包 #include <cstdio> #include <cstring> #include <iostream> using namespace std; + ; #define N 15 long long dp[maxn], ans; int c[N], w[N], V; void Pack(int C, int W) { for(int i = C…
个人心得:炸了炸了,这背包什么的脑阔痛. 完全背包什么鬼咯,状态正向转移与01背包正好相反. 二维数组的状态转移. 一维数组的优化,注意正向覆盖. 本题中的思想 ;y<=year;y++){ ; ;i<=n;i++){ for(int j=bond[i];j<=s;j++){ dp[j]=max(dp[j],dp[j-bond[i]]+gain[i]); } } cash+=dp[s]; } John never knew he had a grand-uncle, until he r…
A - Investment Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2063 Description John never knew he had a grand-uncle, until he received the notary's letter. He learned that his late grand-uncle…