diff options
Diffstat (limited to 'challenge-046/e-choroba/perl/ch-2.pl')
| -rwxr-xr-x | challenge-046/e-choroba/perl/ch-2.pl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-046/e-choroba/perl/ch-2.pl b/challenge-046/e-choroba/perl/ch-2.pl new file mode 100755 index 0000000000..372ad3cc19 --- /dev/null +++ b/challenge-046/e-choroba/perl/ch-2.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl +use warnings; +use strict; +use feature qw{ say }; + +my $MAX = 500; + +my @doors = (0) x $MAX; # All closed. +for my $employee (0 .. $MAX - 1) { + $doors[$_] = ! $doors[$_] + for grep 0 == (1 + $_) % (1 + $employee), 0 .. $MAX - 1; +} +say join ' ', map 1 + $_, grep $doors[$_], 0 .. $MAX; |
