Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Man-or-boy-test/C-sharp/man-or-boy-test-1.cs
Normal file
23
Task/Man-or-boy-test/C-sharp/man-or-boy-test-1.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
|
||||
delegate T Func<T>();
|
||||
|
||||
class ManOrBoy
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Console.WriteLine(A(10, C(1), C(-1), C(-1), C(1), C(0)));
|
||||
}
|
||||
|
||||
static Func<int> C(int i)
|
||||
{
|
||||
return delegate { return i; };
|
||||
}
|
||||
|
||||
static int A(int k, Func<int> x1, Func<int> x2, Func<int> x3, Func<int> x4, Func<int> x5)
|
||||
{
|
||||
Func<int> b = null;
|
||||
b = delegate { k--; return A(k, b, x1, x2, x3, x4); };
|
||||
return k <= 0 ? x4() + x5() : b();
|
||||
}
|
||||
}
|
||||
16
Task/Man-or-boy-test/C-sharp/man-or-boy-test-2.cs
Normal file
16
Task/Man-or-boy-test/C-sharp/man-or-boy-test-2.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
class ManOrBoy
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Console.WriteLine(A(10, () => 1, () => -1, () => -1, () => 1, () => 0));
|
||||
}
|
||||
|
||||
static int A(int k, Func<int> x1, Func<int> x2, Func<int> x3, Func<int> x4, Func<int> x5)
|
||||
{
|
||||
Func<int> b = null;
|
||||
b = () => { k--; return A(k, b, x1, x2, x3, x4); };
|
||||
return k <= 0 ? x4() + x5() : b();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue