摘要: 有数量不限的面值为100,50,20,10,5,1元的纸币,问要组成N(N<=10^6)共有多少种组合方式?(Google笔试题)首先用深搜思想实现的枚举#include <cstdio>#define COM_LEN 6using namespace std;int com[COM_LEN] = {1, 5, 10, 20, 50, 100};void cal_combinations(int num, int *arr, int index, int &res) { if (0 == num) { ++res; return; } if (in... 阅读全文
posted @ 2011-10-15 10:43 杨雨_AlexYang 阅读(858) 评论(1) 推荐(1) 编辑