U E D R , A S I H C RSS

파스칼삼각형/문보창

소감

코드

~cpp 
#include <iostream>
using namespace std;

void find_combination(int n, int c);

int main()
{
	int row, col;
	cin >> row >> col;
	find_combination(row, col);
	return 0;
}

void find_combination(int n, int c)
{
	if (n == 0 || c == 0)
	{
		cout << 1 << endl;
		return;
	}
	int num = 1;
	for (int i = n; i > c; i--)
		num *= i;
	for (i = n - c; i >= 2; i--)
		num /= i;
	cout << num << endl;
}

나한테 할 말

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:23
Processing time 0.0133 sec