AC

名字不要取太长像我这样应该刚刚好  •  16天前


include <bits/stdc++.h>

using namespace std; int a[20200];

int main() {

int n, m;
cin >> n >>m;
for (int i = 1; i <= n; i++) 
	cin >> a[i];
int t = m + 1,ans = 0;
while (t <= n + m) {
	for (int i = 1; i <= m; i++) {
		a[i]--;
		if (a[i] == 0) {
			a[i] = a[t];
			t++;
		}
	}
	ans++;
}
cout << ans;
return 0;

}


评论:

请先登录,才能进行评论