Find m combinations from a N set
来源:互联网 发布:金十网数据官网 编辑:程序博客网 时间:2024/06/05 00:51
Using a recursion method, choose one number first and choose another from the set N -1 till m=0
#include <stdlib.h>int a[10]={1,2,3,4,5,6,7,8,9,0};int count=0;void findCombination(int a[], int inLen, int m, int out[], int outLen){if(m == 0){int j = outLen - 1;for(; j >= 0; j--){printf("%d ", out[j]);}printf("\n");count++;return;}int i;for(i = inLen; i >= m; i--){out[m-1] = a[i-1];findCombination(a,i-1, m-1, out, outLen);}}int main(){int out[3];findCombination(a, 10, 3, out, 3);printf("All combinations count is: %d", count);}
- Find m combinations from a N set
- Find m arrangements from n set
- Find M Integers from an Array of Size N equally
- P26 (**) Generate the combinations of K distinct objects chosen from the N elements of a list.
- Do you know how many combinations to select n numbers from 1 to m with sum of which is mysum?
- P24 (*) Lotto: Draw N different random numbers from the set 1..M.
- N. Find a way
- CareerCup Find all the conflicting appointments from a given list of n appointments.
- zoj 2952 Find All M^N Please
- zoj Find All M^N Please
- zoj 2952 Find All M^N Please
- ZOJ 2952 Find All M^N Please
- n*m 矩阵: set matrix zeroes
- 17-m-Letter Combinations of a Phone Number
- 【leetcode题解】【M】【67】Letter Combinations of a Phone Number
- (M)Backtracking:17. Letter Combinations of a Phone Number
- 排列数算法A(n,m)(n>=m)
- Search a 2D Matrix & Set Matrix Zeroes & Combinations
- 【Oracle】-【TWO_TASK】-TWO_TASK环境变量的作用
- spring ioc原理(看完后大家可以自己写一个spring)
- hdu 1284 钱币兑换问题
- 关于windows程序设计 列表框类 ——environ
- poj 1463 Strategic game(树dp)
- Find m combinations from a N set
- Spring+Hibernate 异常No Hibernate Session bound to thread, and configuration does not allow creation
- 【android】scaleType属性与ImagView中图片的显示的关系 颜色
- timus 1319. Hotel URAL 解题报告
- MFC中绘图
- php之pdo扩展库
- 1046. Shortest Distance (20)—PAT
- 【每天一个Linux命令】08. Linux中time命令的用法
- 电脑换新季让我终于脱离了盗版屌丝群