Artifact d63ada0513560bce41ea7d1a204630cbf157065b:
0000: 2f 2f 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d //--------------
0010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
0040: 2f 2f 20 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6d // number of com
0050: 62 69 6e 61 74 69 6f 6e 73 20 63 68 6f 6f 73 69 binations choosi
0060: 6e 67 20 6b 20 6f 75 74 20 6f 66 20 6e 0a 2f 2f ng k out of n.//
0070: 20 23 20 79 6f 75 20 6d 69 67 68 74 20 62 65 74 # you might bet
0080: 74 65 72 20 63 6f 6e 73 69 64 65 72 20 74 6f 20 ter consider to
0090: 75 73 65 20 50 61 73 63 61 6c 27 73 20 74 72 69 use Pascal's tri
00a0: 61 6e 67 6c 65 0a 2f 2f 20 23 20 66 6f 72 20 63 angle.// # for c
00b0: 6f 6d 62 20 6d 6f 64 75 6c 6f 20 73 6f 6d 65 20 omb modulo some
00c0: 6e 75 6d 62 65 72 2e 2e 2e 0a 2f 2f 0a 2f 2f 20 number....//.//
00d0: 56 65 72 69 66 69 65 64 20 62 79 0a 2f 2f 20 20 Verified by.//
00e0: 20 2d 20 53 52 4d 20 33 35 30 20 44 69 76 31 20 - SRM 350 Div1
00f0: 4c 56 32 0a 2f 2f 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d LV2.//----------
0100: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0110: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0120: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0130: 2d 2d 2d 0a 0a 4c 4c 20 63 6f 6d 62 28 4c 4c 20 ---..LL comb(LL
0140: 6e 2c 20 4c 4c 20 6b 29 0a 7b 0a 09 6b 20 3d 20 n, LL k).{..k =
0150: 6d 69 6e 28 6b 2c 20 6e 2d 6b 29 3b 0a 0a 09 4c min(k, n-k);...L
0160: 4c 20 63 20 3d 20 31 3b 0a 09 66 6f 72 28 4c 4c L c = 1;..for(LL
0170: 20 69 3d 30 3b 20 69 3c 6b 3b 20 2b 2b 69 29 0a i=0; i<k; ++i).
0180: 09 09 63 20 2a 3d 20 6e 2d 69 2c 20 63 20 2f 3d ..c *= n-i, c /=
0190: 20 69 2b 31 3b 0a 09 72 65 74 75 72 6e 20 63 3b i+1;..return c;
01a0: 0a 7d 0a .}.