Erik Myers has been working in the sales field since 2006. Erik started as Sales Director at Fleetmatics and then moved to AlertOps in 2018, where they currently serve as Director of Sales.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define eb emplace_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector< pair<int,int> > vii;
const int INF = 0x3f3f3f3f;
const int T = 1e5 + 10;
int v[T];
int main() {
ios::sync_with_stdio(false);
int n; cin >> n;
int x;
int ans = 0;
int last = 0;
for(int i = 0; i < n; i++) {
cin >> x;
if(x > last) ans += (x - last);
last = x;
}
cout << ans << endl;
return 0;
}
Links
Sign up to view 2 direct reports
Get started