質問編集履歴
1
質問編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
このプログラムでisSetOf1toN のメソッドがしなくてはいけないことは、
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
整数のセットの中でセルの合計数と同じ数字があればtrue をないならfalse を返さなくてはいけないのですが、大学のパソコンでチェックするとこれが出ます。
|
4
|
+
|
5
|
+
「1、4、5、10、12」「2、5、8」「3、9、12」「7」
|
6
|
+
|
7
|
+
expected false but found true どうしてでしょうか?二つ12がありますが、どちらにしてもセルの数と同じなのでいいと思うのですが。
|
6
8
|
|
7
9
|
```java
|
8
10
|
|
@@ -290,8 +292,6 @@
|
|
290
292
|
|
291
293
|
boolean result = true;
|
292
294
|
|
293
|
-
// count the number of cells in the array
|
294
|
-
|
295
295
|
int count = 0;// 10
|
296
296
|
|
297
297
|
// get total number of cells
|
@@ -304,19 +304,29 @@
|
|
304
304
|
|
305
305
|
}
|
306
306
|
|
307
|
-
// get the last number in the array
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
int
|
307
|
+
for (int i = 0; i<t.length; i++){
|
312
|
-
|
308
|
+
|
313
|
-
int
|
309
|
+
for (int j = 0; j<t[i].length; j++){
|
314
|
-
|
315
|
-
|
310
|
+
|
316
|
-
|
317
|
-
if (
|
311
|
+
if (t[i][j] == count ){
|
312
|
+
|
318
|
-
|
313
|
+
result = true;
|
314
|
+
|
315
|
+
return result;
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
}else{
|
320
|
+
|
319
|
-
result = false;
|
321
|
+
result = false;
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
}
|
320
330
|
|
321
331
|
|
322
332
|
|