Cod sursa(job #324536)
Utilizator | Data | 16 iunie 2009 14:59:17 | |
---|---|---|---|
Problema | Operatii | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
ofstream ofis("operatii.out");
ifstream ifis("operatii.in");
long n,v[1000543],cont,i;
int main()
{
ifis>>n;
for (i=1; i<=n; i++) ifis>>v[i];
v[0]=0;
for (i=1; i<=n; i++)
if (v[i]>v[i-1]) cont+=v[i]-v[i-1];
ofis<<cont;
return 0;
}