Pagini recente » Cod sursa (job #1896538) | Cod sursa (job #1994291) | Cod sursa (job #1289347) | Cod sursa (job #1532996) | Cod sursa (job #258515)
Cod sursa(job #258515)
#include<stdio.h>
FILE*fin,*fout;
unsigned long int n,m,k,v[20000000],i,j,x,y,sol,l,g;
int main(){
fin=fopen("stergeri.in","r");
fout=fopen("stergeri.out","w");
fscanf(fin,"%ld %ld %ld\n",&n,&m,&k);
for(i=1;i<=n;i++){v[i]=i;}
for(g=1;g<=m;g++){
fscanf(fin,"%ld %ld\n",&x,&y);
for(i=x;i<=n;i++){v[i]=v[y+1];y++;}
n=n-(j-i+1);
}
fprintf(fout,"%ld",v[k]);
fclose(fin); fclose(fout);
return 0;
} ;