Cod sursa(job #3367346)
| Utilizator | Data | 7 octombrie 2026 10:20:43 | |
|---|---|---|---|
| Problema | Operatii | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
int main()
{
int n;
fin>>n;
int op=0;
int x1,x2;
fin>>x1;
for(int i=1;i<n;i++)
{
x2=x1;
fin>>x1;
if(x1>x2)
op=op+x1-x2;
}
cout<<op;
fout<<op;
return 0;
}
