0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-11 19:06:26 +00:00
OI-codes/Luogu/P1969/P1969.cpp

18 lines
260 B
C++
Raw Normal View History

2020-11-02 13:13:18 +00:00
#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;
}