Cod sursa(job #702427)

Utilizator Stefex09Stefan Teodorescu Stefex09 Data 1 martie 2012 21:47:18
Problema Operatii Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
//#include<iostream>
#include<fstream>
#define MAX 1000010
using namespace std;
int v[MAX],i,n,nr=0;
int main()
{
	ifstream in("operatii.in");
	ofstream out("operatii.out");
	in>>n;
	for(i=1;i<=n;++i)
		in>>v[i];
	for(i=1;i<=n;++i)
		if(v[i]>=v[i-1]) nr+=(v[i]-v[i-1]);
	out<<nr;
	return 0;
}