求大神看看为什么20分??

P1190 [NOIP2010 普及组] 接水问题

给你发个100分程序 ```cpp #include<iostream> using namespace std; int n,m; int w[10001]; int main() { int i,max1,min1,x,j; cin>>n>>m; for(i=1;i<=n;i++) cin>>w[i]; for(i=m+1;i<=n;i++) { min1=1000000; for(j=1;j<=m;j++) { if(w[j]<min1) { min1=w[j]; x=j; } } w[x]=w[i]+w[x]; } max1=0; for(i=1;i<=n;i++) if(w[i]>max1) max1=w[i]; cout<<max1<<endl; return 0; } ```
by rxzfn @ 2017-03-30 20:53:26


```cpp #include<iostream> #include<cstdlib> using namespace std; int main(){ int n,m,time=0,tou[101],shui[10005],he=1000,i=0,da=0; cin>>n>>m; for(int j=0;j<n;++j)cin>>shui[j]; if(m>n){ for(int j=0;j<n;++j) if(shui[j]>da)da=shui[j]; cout<<da; system("pause"); return 0; } else for(;i<m;++i){ tou[i]=shui[i]; shui[i]=0; if(tou[i]<he)he=tou[i]; } i-=1; for(int j=0;j<m;++j){ tou[j]-=he; if(tou[j]==0){ i+=1; tou[j]=shui[i]; shui[i]=0; } } time+=he; he=1000; if(shui[n-1]==0){ cout<<time; return 0; } while(true){ if(shui[n-1]==0){ for(int j=0;j<m;++j) if(tou[j]>da)da=tou[j]; time+=da; cout<<time; system("pause"); return 0; } for(int j=0;j<m;++j) if(tou[j]<he)he=tou[j]; for(int j=0;j<m;++j){ tou[j]-=he; if(tou[j]==0){ i+=1; tou[j]=shui[i]; shui[i]=0; } } time+=he; he=1000; } } 我代码巨长,诶,感觉我把整个过程都模拟了,代码有点长 ```
by 卓扬越 @ 2017-04-11 21:41:20


|