template<unsigned long int _Val>
class Factorial
{
public:
static const unsigned long int value = (_Val * Factorial<_Val - 1>::value);
};
template<>
class Factorial<1>
{
public:
static const unsigned long int value = 1;
};
컴파일러가 계산해줌.
template<unsigned long int _Val>
class Factorial
{
public:
static const unsigned long int value = (_Val * Factorial<_Val - 1>::value);
};
template<>
class Factorial<1>
{
public:
static const unsigned long int value = 1;
};
컴파일러가 계산해줌.
이거 한 50000쓰면 어떻게되나요?
무섭네요
도요타식 팩토리얼 계산법이라고 합니다 이글 내려주세요...