Cod sursa(job #806352)

Utilizator robertpoeRobert Poenaru robertpoe Data 2 noiembrie 2012 17:31:54
Problema Operatii Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.33 kb
#include<cstdio>
#include<fstream>
#define dll long long
using namespace std;
ifstream f("operatii.in");
ofstream g("operatii.out");
int n,i,a,b;
dll nr=0;
int dif;
int main()
{
	f>>n;
	for(i=1;i<=n;i++)
	{
		f>>a;
		if(a>b)
		{
		    dif=a-b;
            nr=nr+dif;
		}
        b=a;
	}
	g<<nr;
	return 0;
}