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 |
大牛们帮我看看吧想写成o(F*V)的,可是失败了。恳请大牛们批评指正,不胜感谢 #include <stdio.h> #include <string.h> int main() { int dp[2][101],f,t,v,i,ii; bool flag=false; scanf("%d%d",&f,&v); t=f; memset(dp,0,sizeof(dp)); ii=1; while(t--) { for(i=0;i<v;i++) { scanf("%d",&dp[ii][i]); if(flag&&dp[1-ii][i-1]>0) dp[ii][i]+=dp[1-ii][i-1]; if(i>f-t-1&&dp[ii][i-1]>dp[ii][i]) dp[ii][i]=dp[ii][i-1]; flag=true; } ii=1-ii; } printf("%d\n",dp[1-ii][v-1]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator