0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 07:11:58 +00:00
OI-codes/problem/P1969/P1969.cpp
2020-11-02 21:13:18 +08:00

18 lines
260 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t, l = 0, ans = 0;
cin >> n;
while (n--) {
cin >> t;
if (t > l) {
ans += t - l;
}
l = t;
}
cout << ans << endl;
return 0;
}