mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-14 05:58:47 +00:00
18 lines
260 B
C++
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;
|
|
}
|