From 35668d8e4ed26194b66b28bf6c1c3051eaaf7e05 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Mon, 19 Oct 2020 20:06:06 +0800 Subject: [PATCH] =?UTF-8?q?P4445=20[AHOI2018=E5=88=9D=E4=B8=AD=E7=BB=84]?= =?UTF-8?q?=E6=8A=A5=E5=90=8D=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R40110902 --- problem/P4445/P4445.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 problem/P4445/P4445.cpp diff --git a/problem/P4445/P4445.cpp b/problem/P4445/P4445.cpp new file mode 100644 index 00000000..d89ed420 --- /dev/null +++ b/problem/P4445/P4445.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; + +int main() { + int n, a[100005]; + long long ans=0; + cin >> n; + for(int i = 0 ; i < n ; i++) { + cin >> a[i]; + } + for(int i = 1 ; i < n ; i++) { + ans += max(a[i], a[i-1]); + } + cout << ans << endl; + return 0; +}