110506 Polynomial coefficients
来源:互联网 发布:hadoop基础教程 python 编辑:程序博客网 时间:2024/06/05 06:41
#include <iostream>using namespace std;static int C(int n, int k){if (k == 0)return 1;int a = 1, b = 1;for (int i = 1; i <= k; ++i){b *= i;a *= n;--n;}return a / b;}static int Calcualte(int* coeffs, int k, int n){if (k == 1)return C(n, coeffs[0]);return C(n, coeffs[k - 1]) * Calcualte(coeffs, k - 1, n - coeffs[k - 1]);}static void RunTest(int n, int k){int* coeffs = new int[k];for (int i = 0; i < k; ++i)cin >> coeffs[i];cout << Calcualte(coeffs, k, n) << endl;delete[] coeffs;}static void Test(){int n, k;while(cin >> n >> k)RunTest(n, k);}int main(int argc, char* argv[]){Test();return 0;}
- 110506 Polynomial coefficients
- programming-challenges Polynomial coefficients (110506) 题解
- uva 10105 polynomial coefficients
- UVA 10105 - Polynomial Coefficients
- 10105 - Polynomial Coefficients
- UVA 10105 - Polynomial Coefficients
- UVA - 10105 Polynomial Coefficients
- UVA 10105 Polynomial Coefficients
- UVA - 10105 Polynomial Coefficients
- UVa 10105 - Polynomial Coefficients
- uva10105 - Polynomial Coefficients(多项式系数)
- UVA 10105 Polynomial Coefficients(数论)
- 10105Polynomial Coefficients 组合数打表
- UVa 10105 - Polynomial Coefficients (排列组合)
- UVA10105 - Polynomial Coefficients(排列组合)
- UVa Problem Solution: 10105 - Polynomial Coefficients
- (挑战编程_5_6)Polynomial coefficients
- UVa 10105 Polynomial Coefficients(组合数学)
- 线程函数分析
- android平台的ocr
- Data Structures and Other Objects Using C++ (Chapter 2) 学习笔记五
- Leetcode: Remove Duplicates from Sorted Array II
- POJ 1066 Treasure Hunt
- 110506 Polynomial coefficients
- 深入浅出 - Android系统移植与平台开发(十) - led HAL简单设计案例分析
- Block编程值得注意的那些事儿
- SQL Server动态管理视图,性能调校语句
- 何为企业
- MongoDB MongoVue 客户端
- 配置SQL Server 2005 express与jdbc连接
- 大牛的链接
- cannot load OCI DLL,126: Navicat