回答編集履歴
1
追加の質問について回答+訂正
test
CHANGED
@@ -1,3 +1,155 @@
|
|
1
|
+
## 訂正版
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
4次元
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
```JavaScript
|
10
|
+
|
11
|
+
let out = []
|
12
|
+
|
13
|
+
for (let d0 = 0 ; d0 < x[0][0].length; d0++){
|
14
|
+
|
15
|
+
out[d0] = []
|
16
|
+
|
17
|
+
for (let d1 = 0 ; d1 < x[0][0][0].length ; d1++){
|
18
|
+
|
19
|
+
out[d0][d1] = []
|
20
|
+
|
21
|
+
for (let d2 = 0 ; d2 < x.length ; d2++){
|
22
|
+
|
23
|
+
out[d0][d1][d2] = []
|
24
|
+
|
25
|
+
// for (let d3 = 0 ; d3 < x[0].length ; d3++){
|
26
|
+
|
27
|
+
// }
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
for (let d0 = 0 ; d0 < x.length; d0++){
|
38
|
+
|
39
|
+
for (let d1 = 0 ; d1 < x[0].length ; d1++){
|
40
|
+
|
41
|
+
for (let d2 = 0 ; d2 < x[0][0].length ; d2++){
|
42
|
+
|
43
|
+
for (let d3 = 0 ; d3 < x[0][0][0].length ; d3++){
|
44
|
+
|
45
|
+
console.log(`out[${d2}][${d3}][${d0}][${d1}] = ${x[d0][d1][d2][d3]}`);
|
46
|
+
|
47
|
+
out[d2][d3][d0][d1] = x[d0][d1][d2][d3];
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
6次元
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
```JavaScript
|
66
|
+
|
67
|
+
let out = []
|
68
|
+
|
69
|
+
for (let d0 = 0 ; d0 < x.length; d0++){//1
|
70
|
+
|
71
|
+
console.log(`${d0}`)
|
72
|
+
|
73
|
+
out[d0] = []
|
74
|
+
|
75
|
+
for (let d1 = 0 ; d1 < x[0][0][0][0].length ; d1++){//4
|
76
|
+
|
77
|
+
console.log(`${d0} ${d1}`)
|
78
|
+
|
79
|
+
out[d0][d1] = []
|
80
|
+
|
81
|
+
for (let d2 = 0 ; d2 < x[0][0][0][0][0].length ; d2++){//4
|
82
|
+
|
83
|
+
console.log(`${d0} ${d1} ${d2}`)
|
84
|
+
|
85
|
+
out[d0][d1][d2] = []
|
86
|
+
|
87
|
+
for (let d3 = 0 ; d3 < x[0].length ; d3++){//1
|
88
|
+
|
89
|
+
console.log(`${d0} ${d1} ${d2} ${d3}`)
|
90
|
+
|
91
|
+
out[d0][d1][d2][d3] = []
|
92
|
+
|
93
|
+
for (let d4 = 0 ; d4 < x[0][0].length ; d4++){//3
|
94
|
+
|
95
|
+
console.log(`${d0} ${d1} ${d2} ${d3} ${d4}`)
|
96
|
+
|
97
|
+
out[d0][d1][d2][d3][d4] = []
|
98
|
+
|
99
|
+
// for (let d5 = 0 ; d5 < x[0][0][0].length ; d5++){//3
|
100
|
+
|
101
|
+
// }
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
for (let d0 = 0 ; d0 < x.length; d0++){
|
116
|
+
|
117
|
+
for (let d1 = 0 ; d1 < x[0].length ; d1++){
|
118
|
+
|
119
|
+
for (let d2 = 0 ; d2 < x[0][0].length ; d2++){
|
120
|
+
|
121
|
+
for (let d3 = 0 ; d3 < x[0][0][0].length ; d3++){
|
122
|
+
|
123
|
+
for (let d4 = 0 ; d4 < x[0][0][0][0].length ; d4++){
|
124
|
+
|
125
|
+
for (let d5 = 0 ; d5 < x[0][0][0][0][0].length ; d5++){
|
126
|
+
|
127
|
+
console.log(`out[${d0}][${d4}][${d5}][${d1}][${d2}][${d3}] = ${x[d0][d1][d2][d3][d4][d5]}`);
|
128
|
+
|
129
|
+
out[d0][d4][d5][d1][d2][d3] = x[d0][d1][d2][d3][d4][d5]
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
## 1回目の回答: 間違いかも
|
150
|
+
|
151
|
+
|
152
|
+
|
1
153
|
こういう話ですか・・?
|
2
154
|
|
3
155
|
|