首页 » OI » 正文

Pascal 链表

type
  linkp=^link;
  link=record
    value:longint;
    pnext:linkp;
   end;
var
  head:array[1..1000] of linkp;
  n,m,x,y,i:longint;
  tmp:linkp;
begin
    read(n,m);
    for i:=1 to n do begin
        read(x,y);
        //Insert
        new(tmp);
        tmp^.value:=x;
        tmp^.pnext:=head[y];
        head[y]:=tmp;
        //Insert
      end;
end.

发表评论