From 182bdf71f72c8069d4cb1d3e03860dcff0f74dad Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Fri, 16 Oct 2020 21:50:12 +0800 Subject: [PATCH] =?UTF-8?q?P1317=20=E4=BD=8E=E6=B4=BC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R39922188 --- problem/P1317/P1317.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 problem/P1317/P1317.cpp diff --git a/problem/P1317/P1317.cpp b/problem/P1317/P1317.cpp new file mode 100644 index 00000000..ef2a3c14 --- /dev/null +++ b/problem/P1317/P1317.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main() { + int n, t, l = 0, q = 0, ans = 0; + cin >> n; + for (int i = 0; i < n; i++) { + cin >> t; + if (t < q) { + l = 1; + } + if (t > q && l == 1) { + l = 0; + ans++; + } + q = t; + } + cout << ans << endl; + return 0; +}