Cod sursa(job #396954)
Utilizator | Data | 16 februarie 2010 09:22:48 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<fstream>
using namespace std;
long long n;
int i,ul,p;
unsigned long long nr;
ifstream f("operatii.in");
ofstream g("operatii.out");
int main()
{
f>>n;
f>>ul;
nr=nr+ul;
for(i=1;i<=n;i++)
{
f>>p;
if(p>ul)
{
nr=nr+(p-ul);
}
ul=p;
}
g<<nr;
return 0;
}