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