Skip to content

Commit eafae5c

Browse files
committed
Day 17 update
1 parent 25d5f3a commit eafae5c

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/day17/Main.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
package day17;
22

3-
import java.util.Arrays;
4-
5-
import org.apache.commons.lang3.ArrayUtils;
6-
7-
83
public class Main {
94
public static void main(String[] args) {
105
int input = 377;
116
int pos = 0;
12-
int[] list = {0};
13-
147

15-
for (int i = 1; i < 5000000; i++) {
16-
pos = ((pos + input) % list.length)+1;
17-
18-
list = ArrayUtils.insert(pos, list, i);
19-
}
20-
21-
System.out.println(Arrays.toString(list));
8+
for (int i = 1; i < 50000001; i++) {
9+
pos = ((pos + input) % i) + 1;
2210

23-
System.out.println(list[ArrayUtils.indexOf(list, 0)+1]);
11+
if (pos == 1) {
12+
System.out.println(i);
13+
}
14+
}
2415
}
2516
}

0 commit comments

Comments
 (0)