Cod sursa(job #3313407)
| Utilizator | Data | 4 octombrie 2025 10:40:18 | |
|---|---|---|---|
| Problema | Operatii | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("operatii.in");
ofstream fout ("operatii.out");
int main()
{
int n,x,last=0;
long long ans=0;
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>x;
if(x>last)
ans+=x-last;
last=x;
}
fout<<ans;
}