Cod sursa(job #1438180)
Utilizator | Data | 19 mai 2015 10:59:58 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <cstdio>
using namespace std;
int v[1000001];
int main()
{
freopen("operatii.in","r",stdin);
freopen("operatii.out","w",stdout);
int n,i,dif;
long long mis=0;
scanf("%d",&n);
for(i=1; i<=n; i++)
scanf("%d", &v[i]);
for(i=1; i<=n; i++)
{
dif=v[i]-v[i-1];
if(dif>0)
mis=mis+dif;
}
printf("%lld",mis);
return 0;
}