Cod sursa(job #239480)
| Utilizator | Data | 4 ianuarie 2009 21:07:50 | |
|---|---|---|---|
| Problema | Operatii | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
#define huge long long
int main()
{
freopen("operatii.in","r",stdin);
freopen("operatii.out","w",stdout);
huge n;
scanf("%lld",&n);
huge curent,precedent;
huge sol=0;
for(huge i=1;i<=n;i++)
{
scanf("%lld",&curent);
if(curent>precedent)
sol=sol+curent-precedent;
precedent=curent;
}
printf("%lld\n",sol);
return 0;
}
