mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 01:18:47 +00:00
18 lines
295 B
C++
18 lines
295 B
C++
#include<bits/stdc++.h>
|
|
|
|
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;
|
|
}
|