Cod sursa(job #540394)
Utilizator | Data | 23 februarie 2011 22:25:31 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.22 kb |
#include<fstream>
using namespace std;
long long a,b,n,i,nr;
int main()
{
ifstream f("operatii.in");
ofstream g("operatii.out");
f>>n;
for(i=1;i<=n;i++)
{
f>>a;
if(a>b)
nr+=a-b;
b=a;
}
g<<nr;
}