Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 为什么这么搞就不对呢~ 找了所有测试数据都过了，提交就wa

Posted by hopeztm at 2012-08-14 17:27:42 on Problem 1260
```#include <stdio.h>
#include <memory.h>

struct Pearl
{
int prize;
};

Pearl allPearl[105];
int dp[105];
int nPearl;

int main()
{
int ncase;

scanf("%d", &ncase);

while(ncase--)
{
scanf("%d", &nPearl);

for( int i = 0; i < nPearl; i++)
{
}

dp[nPearl - 1] = allPearl[nPearl - 1].nbuy;
int replace, minPrize = 100000000;

int sum = (dp[nPearl - 1] + 10) * allPearl[nPearl-1].prize;

for( int i = nPearl - 2; i >= 0; i--)
{
dp[i] = 0;
minPrize = 100000000;

for( int j = nPearl - 1; j >= i; j--)
{
int prize;
if(dp[j] == 0)
{
prize = sum + (allPearl[i].nbuy + 10) * allPearl[j].prize;
}
else
{
prize = sum + (allPearl[i].nbuy ) * allPearl[j].prize;
}

if(prize < minPrize)
{
minPrize = prize;
replace = j;
}
}
sum = minPrize;
}

printf("%d\n", sum);
}

}```

Followed by: