http://projecteuler.net/index.php?section=problems&id=15
Combinationは再帰で書くと簡単。なのでメタプログラミングしてみた。
#include <iostream> template<int N, int M> struct C { static const long long value = C<N,M-1>::value * (N - M + 1) / M; }; template<int N> struct C<N, 0> { static const long long value = 1; }; int main() { std::cout << C<40,20>::value << std::endl; }