-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (25 loc) · 924 Bytes
/
main.py
File metadata and controls
36 lines (25 loc) · 924 Bytes
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
31
32
33
34
35
36
missed_grad_count = 0
def find_miss_ceremony(length,
miss_left,
continue_absent_allow,
path):
global missed_grad_count
if length == 0:
print(path)
if path[-1] == 0:
missed_grad_count += 1
return 1
if miss_left > 0:
miss_path = find_miss_ceremony(length - 1, miss_left - 1, continue_absent_allow, path + [0])
else:
miss_path = 0
no_miss_path = find_miss_ceremony(length - 1, continue_absent_allow, continue_absent_allow, path + [1])
print(f'{length = } {miss_left = } {miss_path = } {no_miss_path = }')
return miss_path + no_miss_path
length = 5
continue_absent_allow = 3
data = find_miss_ceremony(length,
continue_absent_allow,
continue_absent_allow,
[])
print(data, missed_grad_count)