Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #7443482

Source Code Expand

Copy
```#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
∧＿∧
∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
（ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
／　　　＼　 　  |　|
/　　 /￣￣￣￣/　　|
＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/

int N, B[101];
//---------------------------------------------------------------------------------------------------
void _main() {
cin >> N;
rep(i, 1, N) cin >> B[i];

int ans = 0;
ans += B[1]; // A[1]
rep(i, 2, N) ans += min(B[i - 1], B[i]); // A[2]～A[N-1]
ans += B[N-1]; // A[N]
cout << ans << endl;
}

```

#### Submission Info

Submission Time 2019-09-10 08:15:20+0900 C - Maximal Value hamayanhamayan C++14 (GCC 5.4.1) 300 1565 Byte AC 1 ms 256 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample00, sample01, sample02
Case Name Status Exec Time Memory