Cod sursa(job #255872)
Utilizator | Data | 10 februarie 2009 20:16:14 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <stdio.h>
long long n,i,a,x,count;
int main ()
{
freopen ("operatii.in","r",stdin);
freopen ("operatii.out","w",stdout);
scanf ("%lld",&n);
for (i=1;i<=n;i++){
scanf ("%lld",&a);
if (a>x) count=count+a-x;
x=a;
}
printf ("%lld",count);
return 0;
}