0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-24 16:48:49 +00:00
OI-codes/Luogu/problem/P1969/P1969.cpp
2021-01-02 15:30:52 +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;
}