Pagini recente » Cod sursa (job #2207325) | Cod sursa (job #1432951) | Cod sursa (job #2225816) | Cod sursa (job #2460210) | Cod sursa (job #226939)
Cod sursa(job #226939)
var t,n,x,y,i,m,k:longint;
a:array[1..20000000] of longint;
begin
assign(input,'alexc.in');reset(input);
assign(output,'alexc.out');rewrite(output);
readln(n,m,k);
for i:=1 to n do
a[i]:=i;
for i:=1 to m do begin
readln(x,y);
t:=y-x+1;
for i:=x to n-t do
a[i]:=a[i+t];
n:=n-(y-x+1);
end;
write(a[k]);
close(input);close(output);
end.