Cod sursa(job #880053)
| Utilizator | Data | 16 februarie 2013 10:56:20 | |
|---|---|---|---|
| Problema | Operatii | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
// 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 x=0,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;
}
