We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 31c1f20 commit a0aedbdCopy full SHA for a0aedbd
euler/prob015-felher.pl
@@ -0,0 +1,15 @@
1
+use v6;
2
+
3
+# This program doesn't really simulate anything and is only here for the sake of
4
+# completeness. But to show something cool about perl6 let's at least introduce
5
+# the faculty as the ! postfix operator
6
+my Int sub postfix:<!>(Int $n) { [*] 1 .. $n }
7
8
+# The strategy for this Problem is quite straight-forward: To move from the
9
+# upper left to the lower right corner of an NxN grid without ever going in the
10
+# wrong direction one has to go down N times and one has to go right N times.
11
+# The problem is therefore equivalent to "How many distinguishable ways exist to
12
+# order N white and N black balls?" and the answer to that problem is:
13
14
+my \N = 20;
15
+say (2 * N)!/(N! * N!);
0 commit comments