回答編集履歴
1
定数化, 僅かなスピードアップ等
test
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
```
|
6
6
|
|
7
|
-
処理開始:2019-03-23T14:17
|
7
|
+
処理開始:2019-03-23T14:34:10.785
|
8
8
|
|
9
9
|
有効件数:13374192
|
10
10
|
|
11
|
-
処理終了:2019-03-23T14:
|
11
|
+
処理終了:2019-03-23T14:34:29.876
|
12
12
|
|
13
13
|
```
|
14
14
|
|
@@ -28,6 +28,8 @@
|
|
28
28
|
|
29
29
|
private static final int LENGTH = 5;
|
30
30
|
|
31
|
+
private static final int HARF = 15;
|
32
|
+
|
31
33
|
|
32
34
|
|
33
35
|
public static void main(String[] args) {
|
@@ -36,7 +38,7 @@
|
|
36
38
|
|
37
39
|
int count = 0;
|
38
40
|
|
39
|
-
for(int seats=
|
41
|
+
for(int seats=(1<<HARF)-1; seats <= ((1<<HARF)-1)<<HARF; seats++) {
|
40
42
|
|
41
43
|
if(checkSeats(seats)) {
|
42
44
|
|
@@ -70,7 +72,7 @@
|
|
70
72
|
|
71
73
|
private static boolean checkSeats(int seats) {
|
72
74
|
|
73
|
-
if(Integer.bitCount(seats) !=
|
75
|
+
if(Integer.bitCount(seats) != HARF) return false;
|
74
76
|
|
75
77
|
for (int length = 0; length < LENGTH; length++) {
|
76
78
|
|