Cod sursa(job #246273)

Utilizator IoPadPopescu Dan IoPad Data 20 ianuarie 2009 15:35:15
Problema Stergeri Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<iostream.h>
#include<fstream.h>
int main()
{ long n,x,y,k,m,i,x1,y1;
fstream f("stergeri.in", ios::in);
fstream g("stergeri.out", ios::out);
f>>n;
f>>m>>k;
f>>x>>y;
if(k>=x){ k=k+(y-x)+1;}
for(i=2;i<=m;i++){
x1=x;y1=y;
f>> x; f>>y;
if(k>=x+(y1-x1)+1){k=k+(y-x)+1;}
}
g<<k;
g.close();
f.close();
return 0;}