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; +}