最后一个点T,求调,会关注

P1190 [NOIP2010 普及组] 接水问题

@[zrczrczrczrc](/user/974277) 你的复杂度不行啊
by __zhy__ @ 2023-09-19 17:39:45


对 @[zhenghaoyi](/user/716006)
by Please_call_me_DaLao @ 2023-09-29 19:46:08


可以这样 ```cpp #include <iostream> using namespace std; int s[11000],ss; int main(){ int n,m;cin>>n>>m; for(int i=1;i<=n;i++) cin>>s[i]; int t=m+1; while(t<=n+m){ for(int i=1;i<=m;i++){ s[i]--; if(s[i]==0){ s[i]=s[t]; t++; } } ss++; } cout<<ss; return 0; } ```
by hmy_ddxw__awa @ 2023-10-06 14:36:12


建议(麻烦给个关注: ``` #include<bits/stdc++.h> #define int long long using namespace std; int n,m,a[10005],b[105],cnt,t=0; signed main(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; if(i<=m){ b[i]=a[i]; cnt++; } } while(cnt<n){ sort(b+1,b+m+1); int x=cnt+1; b[1]+=a[x]; cnt++; } int k=m+1; sort(b+1,b+m+1); cout<<b[m]; return 0; } ```
by huangmingyi @ 2023-10-09 16:31:18


|