Pagini recente » Cod sursa (job #1138308) | Cod sursa (job #961457) | Cod sursa (job #1624706) | Cod sursa (job #2225254) | Cod sursa (job #880055)
Cod sursa(job #880055)
// operatii.cpp : Defines the entry point for the console application.
//
//#include "stdafx.h"
#include "fstream"
using namespace std;
int main()
{
ifstream f("operatii.in");
ofstream g("operatii.out");
int nr;
f>>nr;
long long e;
long long i,max=0,op=0;
for(i=0;i<nr;i++)
{
f>>e;
if(e>max)
op=op+(e-max);
max=e;
}
g<<op;
return 0;
}