Cod sursa(job #2221358)
Utilizator | Data | 13 iulie 2018 21:19:03 | |
---|---|---|---|
Problema | Operatii | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("operatii.in");
ofstream out("operatii.out");
int main()
{
int n, a, b;
a = 0;
in >> n;
int s = a;
for(int i = 1; i <= n; i ++)
{
in >> b;
if(a < b)
s += (b - a);
a = b;
}
out << s;
return 0;
}