Number of ways to distribute N Paper Set among M students | C ++ implementation of the approach ; Function to return n ! % 1000000007 ; To store the factorial ; Find the factorial ; Function to return the count of possible ways ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; const int MOD = 1000000007 ; int factMod ( int n ) { long fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { fact *= ( i % MOD ) ; fact %= MOD ; } return fact ; } int countWays ( int n , int m ) { return factMod ( m ) ; } int main ( ) { int n = 2 , m = 2 ; cout << countWays ( n , m ) ; return 0 ; }