Precomputation
// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
const int m=1e9+7;
const int n=1e5+10;
long long fact[n];
int main() {
fact[0]=fact[1]=1;
for(int i=2;i<n;i++){
fact[i]=fact[i-1]*i;
}
int num;
cin>>num;
cout<<fact[num];
return 0;
}
Comments
Post a Comment