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 |
求问: 为什么会出现这样的问题?!!在我程序里面 背包的主过程, 这样就A了 for(i=0;i<year;i++) { memset(f,0,sizeof(f)); pack=(amount+s_P)/1000; for(j=0;j<d;j++) for(k=W[j];k<=pack;k++) { f[k]=max(f[k],f[k-W[j]]+P[j]); } s_P+=f[pack]; //pack=(amount+s_P)/1000; } 但是把第四行写成 pack=amount/1000+s_P/1000就WA了(s_P是利息的和,amount是最开始的钱数),我觉得是一样的啊!求问这是我理解题意的问题还是什么? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator