Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Combinations/C-sharp/combinations-3.cs
Normal file
21
Task/Combinations/C-sharp/combinations-3.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
class Combinations
|
||||
{
|
||||
static int k = 3, n = 5;
|
||||
static int [] buf = new int [k];
|
||||
|
||||
static void Main()
|
||||
{
|
||||
rec(0, 0);
|
||||
}
|
||||
|
||||
static void rec(int ind, int begin)
|
||||
{
|
||||
for (int i = begin; i < n; i++)
|
||||
{
|
||||
buf [ind] = i;
|
||||
if (ind + 1 < k) rec(ind + 1, buf [ind] + 1);
|
||||
else Console.WriteLine(string.Join(",", buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue