回答編集履歴
7
修正
test
CHANGED
@@ -198,6 +198,8 @@
|
|
198
198
|
|
199
199
|
}
|
200
200
|
|
201
|
+
|
202
|
+
|
201
203
|
static void Main(string[] args)
|
202
204
|
|
203
205
|
{
|
@@ -268,8 +270,6 @@
|
|
268
270
|
|
269
271
|
Console.ReadKey();
|
270
272
|
|
271
|
-
|
272
|
-
|
273
273
|
}
|
274
274
|
|
275
275
|
}
|
6
修正
test
CHANGED
@@ -144,7 +144,7 @@
|
|
144
144
|
|
145
145
|
{
|
146
146
|
|
147
|
-
|
147
|
+
static List<List<int>> Make_List(List<int> list)
|
148
148
|
|
149
149
|
{
|
150
150
|
|
5
修正
test
CHANGED
@@ -44,8 +44,6 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
-
|
48
|
-
|
49
47
|
foreach(List<int> line in lines)
|
50
48
|
|
51
49
|
{
|
@@ -212,8 +210,6 @@
|
|
212
210
|
|
213
211
|
|
214
212
|
|
215
|
-
|
216
|
-
|
217
213
|
foreach (List<int> line in lines)
|
218
214
|
|
219
215
|
{
|
4
修正
test
CHANGED
@@ -127,3 +127,157 @@
|
|
127
127
|
質問者様がおっしゃっていることを可能な限り再現しました。
|
128
128
|
|
129
129
|
「同じ値は・を付けて」というのは行っていません。
|
130
|
+
|
131
|
+
2次元リストの作り方を変更したバージョン。
|
132
|
+
|
133
|
+
```c#
|
134
|
+
|
135
|
+
using System;
|
136
|
+
|
137
|
+
using System.Collections.Generic;
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
namespace bingo1
|
142
|
+
|
143
|
+
{
|
144
|
+
|
145
|
+
class Program
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
public static List<List<int>> Make_List(List<int> list)
|
150
|
+
|
151
|
+
{
|
152
|
+
|
153
|
+
List<List<int>> new_list = new List<List<int>>();
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
for(int i = 0; i < list.Count; i+=3)
|
158
|
+
|
159
|
+
{
|
160
|
+
|
161
|
+
new_list.Add(list.GetRange(i, 3));
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
for(int y = 0; y < 3; y++)
|
168
|
+
|
169
|
+
{
|
170
|
+
|
171
|
+
List<int> tmp = new List<int>();
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
for(int x = 0; x < 3; x++)
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
List<int> tmp_list = new_list[x];
|
180
|
+
|
181
|
+
tmp.Add(tmp_list[y]);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
new_list.Add(tmp);
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
new_list.Add(new List<int> { list[0], list[4], list[8] });
|
194
|
+
|
195
|
+
new_list.Add(new List<int> { list[2], list[4], list[6] });
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
return new_list;
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
static void Main(string[] args)
|
204
|
+
|
205
|
+
{
|
206
|
+
|
207
|
+
List<List<int>> lines = Make_List(new List<int> { 1, 3, 6, 8, 7, 9, 2, 4, 5 });
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
List<int> input = new List<int> { 1, 6, 5, 2, 7 };
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
foreach (List<int> line in lines)
|
218
|
+
|
219
|
+
{
|
220
|
+
|
221
|
+
int sum = 0;
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
foreach (int i in input)
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
if (line.Contains(i))
|
230
|
+
|
231
|
+
{
|
232
|
+
|
233
|
+
int pos = line.IndexOf(i);
|
234
|
+
|
235
|
+
line[pos] = 0;
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
foreach (int l in line)
|
244
|
+
|
245
|
+
{
|
246
|
+
|
247
|
+
sum += l;
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
if (sum == 0)
|
254
|
+
|
255
|
+
{
|
256
|
+
|
257
|
+
Console.WriteLine("ビンゴ");
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
else
|
262
|
+
|
263
|
+
{
|
264
|
+
|
265
|
+
Console.WriteLine("NOTビンゴ");
|
266
|
+
|
267
|
+
}
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
Console.ReadKey();
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
```
|
3
修正
test
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
-
List<int> input = new List<int> { 1,
|
43
|
+
List<int> input = new List<int> { 1, 6, 5, 2, 7 };
|
44
44
|
|
45
45
|
|
46
46
|
|
2
修正
test
CHANGED
@@ -124,8 +124,6 @@
|
|
124
124
|
|
125
125
|
使いました。
|
126
126
|
|
127
|
-
|
127
|
+
質問者様がおっしゃっていることを可能な限り再現しました。
|
128
|
-
|
129
|
-
可能な限り再現しました。
|
130
128
|
|
131
129
|
「同じ値は・を付けて」というのは行っていません。
|
1
修正
test
CHANGED
@@ -34,19 +34,15 @@
|
|
34
34
|
|
35
35
|
lines.Add(new List<int> { 6, 9, 5 });
|
36
36
|
|
37
|
-
lines.Add(new List<int> { 1, 3, 6 });
|
38
|
-
|
39
37
|
lines.Add(new List<int> { 1, 7, 5 });
|
40
38
|
|
41
39
|
lines.Add(new List<int> { 6, 7, 2 });
|
42
40
|
|
43
41
|
|
44
42
|
|
45
|
-
List<int> input = new List<int> { 1,
|
43
|
+
List<int> input = new List<int> { 1, 3, 6 };
|
46
44
|
|
47
45
|
|
48
|
-
|
49
|
-
int sum = 0;
|
50
46
|
|
51
47
|
|
52
48
|
|
@@ -54,7 +50,11 @@
|
|
54
50
|
|
55
51
|
{
|
56
52
|
|
53
|
+
int sum = 0;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
-
foreach(int i in input)
|
57
|
+
foreach (int i in input)
|
58
58
|
|
59
59
|
{
|
60
60
|
|
@@ -80,23 +80,23 @@
|
|
80
80
|
|
81
81
|
}
|
82
82
|
|
83
|
-
}
|
84
83
|
|
85
84
|
|
85
|
+
if (sum == 0)
|
86
86
|
|
87
|
-
|
87
|
+
{
|
88
88
|
|
89
|
-
|
89
|
+
Console.WriteLine("ビンゴ");
|
90
90
|
|
91
|
-
|
91
|
+
}
|
92
92
|
|
93
|
-
|
93
|
+
else
|
94
94
|
|
95
|
-
|
95
|
+
{
|
96
96
|
|
97
|
-
|
97
|
+
Console.WriteLine("NOTビンゴ");
|
98
98
|
|
99
|
-
|
99
|
+
}
|
100
100
|
|
101
101
|
}
|
102
102
|
|
@@ -114,6 +114,8 @@
|
|
114
114
|
|
115
115
|
|
116
116
|
|
117
|
+
|
118
|
+
|
117
119
|
```
|
118
120
|
|
119
121
|
考えてみました。
|