Cod sursa(job #141283)

Utilizator zalmanDanci Emanuel Sebastian zalman Data 22 februarie 2008 22:33:15
Problema Operatii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
include<fstream.h>
unsigned long x,a,i,b,a,b[10000];  
ifstream f("operatii.in");  
ofstream g("operatii.out"); 

void cit_form()
{
  f>>n;
  for(i=1;i<=n;i++)
   f>>b[i];
} 

void verifica()
{

for(i=1;i<=n;i++)
 {
   if(b[i])
    if(b[i]>a)
	 x+=(b[i]-a)
    a=b[i];	 
 }

}
int main ()  
{
 cit_form();
 verifica();
 
 g<<x;
 f.close();
 g.close();
 return 0;
}