September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1 +1,17 @@
|
|||
N.println(IntStream.rangeClosed(1, 100).filter(i -> Math.pow((int) Math.sqrt(i), 2) == i).boxed().join(", ", "Open Doors: ", ""));
|
||||
class HundredDoors {
|
||||
public static void main(String[] args) {
|
||||
boolean[] doors = new boolean[101];
|
||||
|
||||
for (int i = 1; i < doors.length; i++) {
|
||||
for (int j = i; j < doors.length; j += i) {
|
||||
doors[j] = !doors[j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i < doors.length; i++) {
|
||||
if (doors[i]) {
|
||||
System.out.printf("Door %d is open.%n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue