Cod sursa(job #263338)
Utilizator | Data | 20 februarie 2009 11:16:40 | |
---|---|---|---|
Problema | Operatii | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main () {
long long n,x,y,t=0;
ifstream I("operatii.in");
ofstream O("operatii.out");
I>>n;
I>>x;
for (long long i=1;i<n;i++){
I>>y;
if (x-y>=0)
t=t+x-y;
x=y;
}
O<<t+y;
}