Cod sursa(job #2405926)
Utilizator | Data | 15 aprilie 2019 10:28:33 | |
---|---|---|---|
Problema | Operatii | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
int main()
{
int n;
fin >> n;
int x,last;
long long rasp=0;
for(int i=1;i<=n;i++)
{
fin >> x;
if(x>last) rasp+=(x-last);
last=x;
}
fout << rasp;
return 0;
}