코드 ¶
~cpp // no10105 - Polynomial Coefficients #include <iostream> using namespace std; void main() { int n, k, i, j, temp1, temp2, coeffi; while (cin >> n >> k) { temp1 = temp2 = 1; for (i=0; i<k; i++) { cin >> coeffi; if (coeffi) { for (j=1; j<=coeffi; j++) temp2 *= j; } } for (i=1; i<=n; i++) temp1 *= i; cout << temp1/temp2 << endl; } }