U E D R , A S I H C RSS

파스칼삼각형/곽세환

~cpp 
#include <iostream>
using namespace std;

int f(int, int);

int main()
{
	int r, c;
	cout << "몇번째 행, 열 ? : ";
	cin >> r >> c;
	cout << f(c, r) << endl;

	return 0;
}

int f(int a, int b) //a가 열 b가 행
{
	if (a > b)
		return 0;
	else if (a == 1 || a == b + 1)
		return 1;
	else
		return f(a, b - 1) + f(a - 1, b - 1);
}
DeleteMe 이 소스 컴파일이 안되는걸요? - 아무개
컴파일은 잘 됩니다(VC++6.0) -세환

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