class ArrayElement object def __init__ self next self self self next n

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class ArrayElement(object):
def __init__(self, p, q, next):
self.p = p
self.q = q
self.next = next
n = int(input())
array = []
array.append(ArrayElement(0, 1, 1))
array.append(ArrayElement(1, 1, 0))
k = 2
for i in range(2, n + 1):
j1 = 0
j2 = array[j1].next
while j2 != 0:
if array[j1].q + array[j2].q == i:
array.append(ArrayElement(array[j1].p + array[j2].p, i, j2))
array[j1].next = k
k += 1
j1 = j2
j2 = array[j1].next
print("%s / %s" % (array[0].p, array[0].q))
w = array[0].next
while True:
print("%s / %s" % (array[w].p, array[w].q))
w = array[w].next
if w == 1:
break