cpp_lib

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub idat50me/cpp_lib

:warning: Factorial(階乗) (math/factorial.cpp)

Verified with

Code

#pragma once
/*
 * @brief Factorial(階乗)
 */

#ifndef call_include
#define call_include
#include <bits/stdc++.h>
using namespace std;
#endif

long long factorial(int x, long long p = (1LL << 62) - 1) {
	long long res = 1;
	for(int i = 2; i <= x; i++) (res *= i) %= p;
	return res;
}
#line 2 "math/factorial.cpp"
/*
 * @brief Factorial(階乗)
 */

#ifndef call_include
#define call_include
#include <bits/stdc++.h>
using namespace std;
#endif

long long factorial(int x, long long p = (1LL << 62) - 1) {
	long long res = 1;
	for(int i = 2; i <= x; i++) (res *= i) %= p;
	return res;
}
Back to top page