• API
• FAQ
• Tools
• Archive
daily pastebin goal
65%
SHARE
TWEET

# Untitled

a guest Jan 17th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. type
2.   Pnode = ^Node;
3.   Node = record
4.     count: integer;
5.     next: Pnode;
6.   end;
7.
8. function CreateNode(NewCount: integer): Pnode;
9. var
10.   NewNode: Pnode;
11. begin
12.   new(NewNode);
13.   NewNode^.count := NewCount;
14.   NewNode^.next := nil;
15.   result := NewNode;
16. end;
17. //пидоры
19. begin
22. end;
23.
25. begin
26.   NewNode^.next := p^.next;
27.   p^.next := NewNode;
28. end;
29.
31. var
32.   q: Pnode;
33. begin
36.   else
37.   begin
38.     while (q <> nil) and (q^.next <> p) do
39.       q := q^.next;
40.     if q <> nil then AddAfter(q, NewNode);
41.   end;
42. end;
43.
44. function FindPlace(head: Pnode; Count: integer): Pnode;
45. var
46.   q: Pnode;
47. begin
49.   while (q <> nil) and (q^.count < Count) do
50.     q := q^.next;
51.   result := q;
52. end;
53.
54. var
56.   w: string;
57.   z: integer;
58.   f: text;
59.
60. begin
62.   Assign(f, 'input.txt');
63.   reset(f);
65.   z := StrToInt(w);
66.   NewNode := CreateNode(z);
68.
69.   While True do
70.   begin
72.     z := StrToInt(w);
73.     if z = 0 then break
74.     else
75.     begin
76.       NewNode := CreateNode(z);
79.     end;
80.   end;
81.   Close(f);
82.