Cod sursa(job #181040)
Utilizator | Data | 17 aprilie 2008 20:24:46 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <fstream>
using namespace std;
ifstream in("operatii.in");
ofstream out("operatii.out");
int main() {
int N, last = 0, now;
long long cnt = 0;
in >> N;
for(int i = 0; i < N; ++i) {
in >> now;
cnt += (last < now ? now - last : 0);
last = now;
}
out << cnt << "\n";
return 0;
}