回答編集履歴
1
別案を追加
test
CHANGED
@@ -17,3 +17,27 @@
|
|
17
17
|
print(ans)
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
再帰を使った別案です。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```python
|
28
|
+
|
29
|
+
def solve(n, row=0):
|
30
|
+
|
31
|
+
return row if n in classes[row] else solve(n, row+1)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
classes = [[4,5,9,10],[0,2,7],[1,3,6,8,11]]
|
36
|
+
|
37
|
+
ans = list(map(solve, range(12)))
|
38
|
+
|
39
|
+
print(ans)
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```
|