Cod sursa(job #492887)
Utilizator | Data | 16 octombrie 2010 11:41:45 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream>
using namespace std;
ifstream fin("operatii.in");
ofstream fout("operatii.out");
long long N,nr,acum=0,ant=0;
int main()
{
fin>>N;
for(int i=1;i<=N;i++)
{ fin>>acum;
if(acum>ant) nr+=acum-ant;
ant=acum;
}
fout<<nr;
fin.close();
fout.close();
return 0;
}