3317. Find the Number of Possible Ways for an Event Hard
1/**
2 * [3317] Find the Number of Possible Ways for an Event
3 *
4 * You are given three integers n, x, and y.
5 * An event is being held for n performers. When a performer arrives, they are assigned to one of the x stages. All performers assigned to the same stage will perform together as a band, though some stages might remain empty.
6 * After all performances are completed, the jury will award each band a score in the range [1, y].
7 * Return the total number of possible ways the event can take place.
8 * Since the answer may be very large, return it modulo 10^9 + 7.
9 * Note that two events are considered to have been held differently if either of the following conditions is satisfied:
10 *
11 * Any performer is assigned a different stage.
12 * Any band is awarded a different score.
13 *
14 *
15 * <strong class="example">Example 1:
16 * <div class="example-block">
17 * Input: <span class="example-io">n = 1, x = 2, y = 3</span>
18 * Output: <span class="example-io">6</span>
19 * Explanation:
20 *
21 * There are 2 ways to assign a stage to the performer.
22 * The jury can award a score of either 1, 2, or 3 to the only band.
23 * </div>
24 * <strong class="example">Example 2:
25 * <div class="example-block">
26 * Input: <span class="example-io">n = 5, x = 2, y = 1</span>
27 * Output: 32
28 * Explanation:
29 *
30 * Each performer will be assigned either stage 1 or stage 2.
31 * All bands will be awarded a score of 1.
32 * </div>
33 * <strong class="example">Example 3:
34 * <div class="example-block">
35 * Input: <span class="example-io">n = 3, x = 3, y = 4</span>
36 * Output: 684
37 * </div>
38 *
39 * Constraints:
40 *
41 * 1 <= n, x, y <= 1000
42 *
43 */
44pub struct Solution {}
45
46// problem: https://leetcode.com/problems/find-the-number-of-possible-ways-for-an-event/
47// discuss: https://leetcode.com/problems/find-the-number-of-possible-ways-for-an-event/discuss/?currentPage=1&orderBy=most_votes&query=
48
49// submission codes start here
50
51impl Solution {
52 pub fn number_of_ways(n: i32, x: i32, y: i32) -> i32 {
53 0
54 }
55}
56
57// submission codes end
58
59#[cfg(test)]
60mod tests {
61 use super::*;
62
63 #[test]
64 fn test_3317() {
65 }
66}
67
Back
© 2025 bowen.ge All Rights Reserved.