Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/Anonymous-recursion/D/anonymous-recursion-2.d
Normal file
18
Task/Anonymous-recursion/D/anonymous-recursion-2.d
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import std.stdio;
|
||||
|
||||
int fib(in int n) pure nothrow {
|
||||
assert(n >= 0);
|
||||
|
||||
return (new class {
|
||||
static int opCall(in int m) pure nothrow {
|
||||
if (m < 2)
|
||||
return m;
|
||||
else
|
||||
return opCall(m - 1) + opCall(m - 2);
|
||||
}
|
||||
})(n);
|
||||
}
|
||||
|
||||
void main() {
|
||||
writeln(fib(39));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue