type str=byte; type spus=^sp; sp= record v: byte; next:spus; end; var pss:spus;s:str; i,n,k:byte; F:TEXT; procedure add (s: str; var h: spus); var p: spus; begin new (p); p^.v := s; p^.next := h; h := p end; function isin (s: str; h: spus): boolean; {належнiсть s до ss} begin if h = nil then isin := false else begin while (H^.next <> nil) and (h^.v <> s) do h := h^.next; {h^.next=nil)or(h^.v=s)} isin:= (h^.v= s) end end; procedure del (s:str; var h: spus); var p, pp: spus; stop:boolean; begin if h<>nil then if h^.v = s then begin PP:=h; h:= h^.next; dispose (pp); pp :=nil end else begin p := h; stop := false; while (p^.next <> nil) and not stop do if p^.next^.v = s then stop := true else p:= p^.next; {pA.next = nil - елемента з заданим значенням немає або} {stop = true-треба вилучити елемент p^.next} if stop then begin pp := p^.next; p^.next := pp^.next; dispose (pp); pp := nil end end end; procedure writelst (h: spus); begin while h <> nil do begin h := h^.next end;end; begin readln(n,k); pss :=nil; write('n='); for s:=n downto 1 do add (s, pss); writelst (pss); {write('k=');} i:=1; while pss<>nil do begin if pss^.v=10 then del(i,pss); writelst(pss); i:=i+1; end; writeln(k); end.