Surjective Functions Small

Surjective Functions Small

Hard Computer Mathematics Sets, Relations & Functions 29 views
Explanation Complexity

Problem Statement

Count surjections from n to m for small n,m (

Input Format

Two integers n m.

Output Format

One integer.

Example

3 2
6

Constraints

n,m

Input / Output Format

Input Format
Two integers n m.
Output Format
One integer.
Constraints
n,m

Examples

Input:
3 2
Output:
6

Example Solution (Public)

Computer Mathematics
Use inclusion-exclusion: m^n - C(m,1)*(m-1)^n + C(m,2)*(m-2)^n ...

Official Solution Code

Use inclusion-exclusion: m^n - C(m,1)*(m-1)^n + C(m,2)*(m-2)^n ...
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.