Cod sursa(job #2736683)
Utilizator | Data | 3 aprilie 2021 19:23:23 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
long long n, x, y, op;
int main()
{
fin >> n;
for(int i=1; i<=n; i++)
{
fin >> x;
if(x>y)
op+=x-y;
y=x;
}
fout << op;
return 0;
}