0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 20:31:58 +00:00
OI-codes/Luogu/P1969/P1969.cpp

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