#include<bits/stdc++.h> using namespace std; int n,w[11000],m,ans,maxx; int main(){ scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&w[i]); int t=m+1; while(t<=n+1){ for(int i=1;i<=m;i++){ w[i]--; if(w[i]==0){ w[i]=w[t]; t++; } } ans++; } for(int i=1;i<=m;i++) maxx=max(maxx,w[i]); cout<<ans+maxx<<endl; }
标签:std,maxx,11000,int,问题,main,P1855 From: https://www.cnblogs.com/lhf123/p/17430816.html