Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的方法貌似正确,结果WA,请指教下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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator