Created
February 21, 2014 12:26
-
-
Save musoftware/9133393 to your computer and use it in GitHub Desktop.
Combinatoric selections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace eular_53 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
long exeedsmilliom = 0; | |
for (int n = 1; n <= 100; n++) | |
for (int r = 1; r <= 100; r++) | |
if (C(n, r) > 1000000) exeedsmilliom++; | |
Console.WriteLine(exeedsmilliom); | |
Console.ReadKey(); | |
} | |
static public double multiplexer(int num) | |
{ | |
double tmp = 1; | |
for (int c = 1; c <= num; c++) | |
tmp *= c; | |
return tmp; | |
} | |
static public double C(int n, int r) | |
{ | |
return multiplexer(n) / (multiplexer(r) * multiplexer(n - r)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment