Cod sursa(job #795017)
| Utilizator | Data | 7 octombrie 2012 15:00:25 | |
|---|---|---|---|
| Problema | Operatii | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <cstdio>
#include <cstdlib>
using namespace std;
int N, last, now, i;
long long ans;
int main()
{
freopen("operatii.in", "r", stdin);
freopen("operatii.out", "w", stdout);
for(scanf("%i", &N), i = 1; i <= N; i++, last = now)
{
scanf("%i", &now);
if(now > last) ans += 1LL * (now - last);
}
printf("%lld\n", ans);
return 0;
}
