Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
23786 | qwertyuiop | 接水问题 | C++ | 解答错误 | 0 MS | 252 KB | 370 | 2023-07-16 17:41:26 |
#include <bits/stdc++.h> using namespace std; int s[100005]; int main() { int n,m,ans; cin>>n>>m; for(int i=1;i<=n;i++)cin>>s[i]; sort(s,s+n); 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++; } } ans++; } cout<<ans; return 0; }