Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue