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

我的方法貌似正确,结果WA,请指教下

Posted by mingruoyuan at 2009-01-22 16:39:23 on Problem 1651
In Reply To:哪为大虾帮忙写下动态转移方程??感激不尽 Posted by:mingruoyuan at 2009-01-22 16:08:33
#include<stdio.h>
int main()
{
int k,i,j,n;
long sum,s[101][101];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%ld",&s[i][i]);
for(i=2;i<n;i++)
for(j=1;j<=n-i;j++)
for(k=j+1;k<j+i;k++)
{
	sum=s[j][k]+s[j][j]*s[k][k]*s[i+j][i+j]+s[k][i+j];
	if(s[j][i+j]==0||s[j][i+j]>sum) s[j][i+j]=sum;
}
printf("%ld",s[1][n]);
return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator