Cezary Grądys
unread,Feb 20, 2017, 4:49:58 AM2/20/17You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Witam.
Chciałbym wygenerować wszystkie możliwe zestawy liczb w totolotku.
Pierwsze nieeleganckie podejście to 6 pętli for:
----------------------------------------------------------
#!/usr/bin/perl
use strict;
for (my $a=6;$a<50;$a++) {
for (my $b=5;$b<$a;$b++){
for (my $c=4;$c<$b;$c++){
for (my $d=3;$d<$c;$d++){
for (my $e=2;$e<$d;$e++){
for (my $f=1;$f<$e;$f++){
print "$a\t$b\t$c\t$d\t$e\t$f\n";
}
}
}
}
}
}
print "\n";
-----------------------------------------------------------
Mogło by tak zostać, ale totolotek to tylko przykład tu może się
zmienić liczba tych pętli. Poszukuję bardziej ogólnego sposobu,
tak, żeby łatwo wygenerować zestawy 5,6 czy 10 liczb.