好矩阵
题解
讨论
查看他人的提交
题号:NC261973
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
我们定义一个矩阵为“好矩阵”,当且仅当该矩阵所有2*2的子矩阵数字和为偶数。
例如:
[[1,2,3],[2,3,4]]
是好矩阵,两个2*2的子矩阵的和分别是8和12。
请问
行
列,矩阵中每个数均在
范围内的好矩阵有多少种?由于答案过大,请对
取模。
数据范围:
保证
为偶数。
示例1
输入
复制
2,2,2
2,2,2
返回值
复制
8
8
说明
合法的8个矩阵为:
好矩阵
返回全部题目
列表加载中...
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ public int numsOfGoodMatrix (int n, int m, int x) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ int numsOfGoodMatrix(int n, int m, int x) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @param m int整型 # @param x int整型 # @return int整型 # class Solution: def numsOfGoodMatrix(self , n , m , x ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ public int numsOfGoodMatrix (int n, int m, int x) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ function numsOfGoodMatrix( n , m , x ) { // write code here } module.exports = { numsOfGoodMatrix : numsOfGoodMatrix };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @param m int整型 # @param x int整型 # @return int整型 # class Solution: def numsOfGoodMatrix(self , n: int, m: int, x: int) -> int: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ func numsOfGoodMatrix( n int , m int , x int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ int numsOfGoodMatrix(int n, int m, int x ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @param m int整型 # @param x int整型 # @return int整型 # class Solution def numsOfGoodMatrix(n, m, x) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ def numsOfGoodMatrix(n: Int,m: Int,x: Int): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ fun numsOfGoodMatrix(n: Int,m: Int,x: Int): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ public int numsOfGoodMatrix (int n, int m, int x) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ export function numsOfGoodMatrix(n: number, m: number, x: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ func numsOfGoodMatrix ( _ n: Int, _ m: Int, _ x: Int) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @param m int整型 * @param x int整型 * @return int整型 */ pub fn numsOfGoodMatrix(&self, n: i32, m: i32, x: i32) -> i32 { // write code here } }
2,2,2
8