###### poj 2063 Investment


#include<iostream>
#include<string.h>
#include<math.h>
#include<fstream>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<vector>
#define MAXSIZE 100
using namespace std;
int N = 0, original = 0, years = 0;
int value[11], interest[11], d = 0;
int dp[200010];
int ans = 0;
int main()
{
//freopen("data_2063.txt","r",stdin);
scanf("%d", &N);
while(N--)
{
ans = 0;
memset(dp, 0, sizeof(dp));
scanf("%d%d", &original, &years);
scanf("%d", &d);
for (int i = 0; i < d; i++)
{
scanf("%d%d", &value[i], &interest[i]);
value[i] /= 1000;
}
ans = original;
for (int i = 0; i < years; i++)
{
memset(dp, 0, sizeof(dp));
original = ans / 1000;
for (int j = 0; j < d; j++)
{
for (int k = 0; k <= original; k++)
{
if (k >= value[j])
{
dp[k] = max (dp[k], dp[k - value[j]] + interest[j]);
}
}
}
ans += dp[original];
}
printf("%d\n", ans);
}
return 0;
}



#### HDU1963 && POJ2063：Investment(完全背包)

2013-07-24 15:56:14

#### poj2063 - Investment

2012-05-24 17:48:32

#### POJ - 2063 Investment(01背包)

2015-09-19 10:16:27

#### POJ 2063 Investment 完全背包

2013-04-25 21:15:55

#### poj——2063——Investment（dp）

2013-10-26 15:04:13

#### POJ 2063 Investment(完全背包)

2014-10-25 15:19:14

#### poj 2063 Investment (完全背包)

2013-07-31 16:38:12

#### POJ 2063 Investment（完全背包）

2014-04-23 17:02:19

#### poj 2063 Investment 背包

2015-02-04 10:12:50

#### Poj 2063 Investment

2014-11-22 19:17:07

## 不良信息举报

poj 2063 Investment