Cod sursa(job #1596187)
Utilizator | Data | 10 februarie 2016 20:46:02 | |
---|---|---|---|
Problema | Operatii | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream>
#include<algorithm>
#include<vector>
#include<stdlib.h>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
int main()
{
long long s;
int n, i, maxx=0, t;
fin>>n;
for(i=1; i<=n; i++){
fin>>t;
if(t>maxx) s+=t-maxx;
maxx=t; }
fout<<s;
}