- 粘贴文本
- 2009-08-01 21:50:16 @
样例过得去的。
type
link=^node;
node=record
data:longint;
next:link;
end;
var
head,p,q,ch,ct,fh,ft,inh,int:link;
n:longint;
k:longint;
procedure init;
var
i:longint;
begin
readln(n,k);
new(p);
p^.data:=0;
p^.next:=nil;
head:=p;
for i:=1 to n do
begin
new(q);
q^.data:=i;
q^.next:=nil;
p^.next:=q;
p:=q;
end;
new(q);
q^.data:=100000;
q^.next:=nil;
p^.next:=q;
end;
procedure work;
var
i,j,h,t,po:longint;
begin
for i:=1 to k do
begin
readln(h,t,po);
p:=head;
for j:=1 to h-1 do p:=p^.next;
ch:=p;
p:=p^.next;
fh:=p;
for j:=h+1 to t do p:=p^.next;
ct:=p^.next;
ft:=p;
p:=head;
for j:=1 to po do p:=p^.next;
inh:=p;
int:=p^.next;
inh^.next:=fh;
ft^.next:=int;
ch^.next:=ct;
p:=head;
end;
p:=head;
for i:=1 to 10 do
begin
p:=p^.next;
writeln(p^.data);
end;
end;
begin
init;
work;
end.