September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,13 +1,6 @@
|
|||
public class HundredDoors {
|
||||
class HundredDoors {
|
||||
public static void main(String[] args) {
|
||||
boolean[] doors = new boolean[101];
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
for (int j = i; j <= 100; j++) {
|
||||
if(j % i == 0) doors[j] = !doors[j];
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
System.out.printf("Door %d: %s%n", i, doors[i] ? "open" : "closed");
|
||||
}
|
||||
for (int i = 1; i <= 10; i++)
|
||||
System.out.printf("Door %d is open.%n", i * i);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue