Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -1,6 +1,4 @@
import std.stdio, std.bigint;
T binomial(T)(/*in*/ T n, T k) /*pure nothrow*/ {
T binomial(T)(in T n, T k) pure /*nothrow*/ {
if (k > (n / 2))
k = n - k;
T bc = 1;
@ -10,7 +8,9 @@ T binomial(T)(/*in*/ T n, T k) /*pure nothrow*/ {
}
void main() {
import std.stdio, std.bigint;
foreach (d; [[5, 3], [100, 2], [100, 98]])
writefln("(%3d %3d) = %s", d[0], d[1], binomial(d[0], d[1]));
writeln("(100 50) = ", binomial(BigInt(100), BigInt(50)));
writeln("(100 50) = ", binomial(100.BigInt, 50.BigInt));
}