Pagini recente » Diferente pentru problema/xcmmdc intre reviziile 5 si 4 | Diferente pentru problema/sate intre reviziile 6 si 22 | Cod sursa (job #3268687) | Cod sursa (job #1516720) | Cod sursa (job #1515717)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i, n, x, y;
long long cnt = 0;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
fin >> n;
x = 0;
for (i = 1; i <= n; ++i)
{
fin >> y;
if (y > x) cnt += (y - x);
x = y;
}
fout << cnt << "\n";
fin.close();
fout.close();
return 0;
}