蒟蒻求助,为什么第二个点会WA

P1190 [NOIP2010 普及组] 接水问题

发错了
by nofall @ 2018-11-02 16:54:07


[是这个](https://www.luogu.org/recordnew/show/12958154)
by nofall @ 2018-11-02 16:54:34


前排滋滋
by nofall @ 2018-11-02 17:01:09


~~那说明写挂了~~(逃
by yijan @ 2018-11-02 17:06:51


``` #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n,m,w[11000]; int i,ans; cin>>n>>m; for(i=1;i<=n;i++) cin>>w[i]; int t=m+1; ans=0; while(t<=n+m) { for(i=1;i<=m;i++) { w[i]--; if(w[i]==0) { w[i]=w[t]; t++; } } ans++; } printf("%d\n",ans); return 0; } ```
by nofall @ 2018-11-02 17:07:26


代码
by nofall @ 2018-11-02 17:07:33


@[yijan](/space/show?uid=63398) 。。。
by nofall @ 2018-11-02 17:07:53


本蒟蒻跟你的思路差不多,看看我的吧^_^ #include<iostream> #include<cstring> #include<cmath> #include<cstdio> #include<cstdlib> #include<algorithm> using namespace std; int main() { int a[100000],n,m,i,t=0,ans=0; cin>>n>>m; for(i=0;i<n;i++) { cin>>a[i]; }//输入就不用说了吧 while(t<n)//如果有人还没接循环 { for(i=0;i<m;i++)//模拟每一秒的情况 { a[i]--;//那么每个人还需要的量 if(a[i]==0)//如果有人接完了 { a[i]=a[m+t];//就替换 t++;//接完的人就多了一个,so,t++; } } ans++;//秒数++ } cout<<ans;//愉快的输出~~ return 0;//拜拜~~ }
by Liveddd @ 2018-11-02 17:16:10


@[Kevin·HAN](/space/show?uid=109659) 谢谢,已解决
by nofall @ 2018-11-02 17:23:00


@[Kevin·HAN](/space/show?uid=109659) 您太巨了
by nofall @ 2018-11-02 17:24:33


| 下一页