Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of K-Even Arrays

med
30 min
Try to solve the Find the Number of K-Even Arrays problem.

Statement

You are given three integers n, m, and k.

An array arr of length n is called valid if:

  • Each element arr[i] is an integer satisfying 1≤1 \le arr[i] ≤\le m for all 0≤0 \le i <n< n.

  • There are exactly k indices i (0≤0 \le i <n−1< n - 1) such that both arr[i] and arr[i + 1] are even.

Return the total number of such valid arrays. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \le n ≤750\le 750

  • 0≤0 \le k ≤\le n −1- 1

  • 1≤1 \le m ≤1000\le 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Number of K-Even Arrays

med
30 min
Try to solve the Find the Number of K-Even Arrays problem.

Statement

You are given three integers n, m, and k.

An array arr of length n is called valid if:

  • Each element arr[i] is an integer satisfying 1≤1 \le arr[i] ≤\le m for all 0≤0 \le i <n< n.

  • There are exactly k indices i (0≤0 \le i <n−1< n - 1) such that both arr[i] and arr[i + 1] are even.

Return the total number of such valid arrays. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \le n ≤750\le 750

  • 0≤0 \le k ≤\le n −1- 1

  • 1≤1 \le m ≤1000\le 1000