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 tigerhy1 at 2005-04-25 13:45:44 on Problem 2355
```#include <stdio.h>

int l1,l2,l3,c1,c2,c3;
int n;
int a,b;
int distance[20002];
int cost[20002];
int i,j,td;

main()
{
//freopen("2355.in","r",stdin);
//freopen("2355.out","w",stdout);
scanf("%d%d%d%d%d%d",&l1,&l2,&l3,&c1,&c2,&c3);
scanf("%d",&n);
scanf("%d%d",&a,&b);
for (i=2; i<=n; i++) scanf("%d",&distance[i]);
distance[1]=0;
for (i=1; i<=n; i++) cost[i]=1500000000;
cost[a]=0;
for (i=a; i<=b; i++)
{
for (j=i+1; j<=b; j++)
{
td=distance[j]-distance[i];
if (td<=l3)
{
if (td==0) cost[j]=cost[i];
if (td>0 && td<=l1 && cost[i]+c1<cost[j]) cost[j]=cost[i]+c1;
if (td>l1 && td<=l2 && cost[i]+c2<cost[j]) cost[j]=cost[i]+c2;
if (td>l2 && cost[i]+c3<cost[j]) cost[j]=cost[i]+c3;
}
else break;
}
}
printf("%d\n",cost[b]);
}```

Followed by: