From a287c8d2bfe803d655ec52482b999f8a669af561 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Wed, 30 Jun 2021 15:24:32 +0800 Subject: [PATCH] =?UTF-8?q?P1190=20[NOIP2010=20=E6=99=AE=E5=8F=8A=E7=BB=84?= =?UTF-8?q?]=20=E6=8E=A5=E6=B0=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R52213952 --- Luogu/problem/P1190/P1190.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Luogu/problem/P1190/P1190.cpp diff --git a/Luogu/problem/P1190/P1190.cpp b/Luogu/problem/P1190/P1190.cpp new file mode 100644 index 00000000..f4e936f1 --- /dev/null +++ b/Luogu/problem/P1190/P1190.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +int n, m, w[10005], p, t, s; + +int main() { + cin >> n >> m; + for (int i = 0; i < n; i++) { + cin >> w[i]; + } + p = m; + while (p <= n) { + for (int i = 0; i < m; i++) { + w[i]--; + if (!w[i]) { + w[i] = w[p++]; + } + } + t++; + } + for (int i = 0; i < m; i++) { + s = max(s, w[i]); + } + cout << t + s << endl; + return 0; +}