Cod sursa(job #143003)

Utilizator blasterzMircea Dima blasterz Data 25 februarie 2008 20:03:25
Problema Operatii Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
#include <cstdio>

int main()
{
    long long n, i, h, hn, s=0;

    freopen("operatii.in","r",stdin);
    freopen("operatii.out","w",stdout);
    scanf("%lld", &n);
    for(i=1;i<=n;++i)
    {
	scanf("%lld ",&hn);
       if(hn>h) s+=(hn-h);
	h=hn;
    }
printf("%lld\n", s);    
return 0;
}