Cod sursa(job #890832)
Utilizator | Data | 25 februarie 2013 12:13:38 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include <fstream>
using namespace std;
ifstream f("operatii.in");
ofstream g("operatii.out");
int n,x,y,i,d;
long long z;
int main (){
f>>n;
while(f>>x){
if(x>y)
{
d=x-y;
z+=d;
}
y=x;
}
g<<z;
return 0;
}