Skip to content

Practice Find the Number of Possible Ways for an Event

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3317
LeetCode Problem

Find the Number of Possible Ways for an Event

Problem Statement

Assign each of n distinct performers to one of x stages. Empty stages are allowed. Each nonempty stage forms a band that receives one of y possible scores. Two events differ if a performer’s stage assignment or a band’s score differs. Return the number of events modulo 10^9 + 7.

Source: Find the Number of Possible Ways for an Event on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 1, x = 2, y = 3
Output
6

# Example 2

Input
n = 5, x = 2, y = 1
Output
32

# Example 3

Input
n = 3, x = 3, y = 4
Output
684

Constraints

1 <= n, x, y <= 1000

Related LeetCode Problems

Practice more problems similar to Find the Number of Possible Ways for an Event.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.