constexpr unsigned long long factorial(int n){
 unsigned long long r=1;
 for(int i=1;i<=n;++i){r*=i;}
 return r;
}

うん、簡単だね!