Cod sursa(job #3314769)
| Utilizator | Data | 11 octombrie 2025 08:51:05 | |
|---|---|---|---|
| Problema | Operatii | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <cstring>
#define int long long
using namespace std;
string filename = "operatii";
ifstream fin (filename + ".in");
ofstream fout (filename + ".out");
signed main()
{
int n;
fin>>n;
int ans = 0;
int x;
int last;
for(int i=1;i<=n;i++)
{
fin>>x;
if(x>last)
ans += (x - last);
last = x;
}
fout<<ans;
}
