Cod sursa(job #3224431)
Utilizator | Data | 15 aprilie 2024 13:13:51 | |
---|---|---|---|
Problema | Operatii | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
long long int r;
int n, x, u;
int main() {
fin.tie(nullptr);
fout.tie(nullptr);
fin >> n;
for(i = 1; i <= n; i++) {
fin >> x;
if(x > u) r += x - u;
u = x;
}
fout << r;
return 0;
}