题目链接 题意:一个矩阵里有很多格子,每个格子有两种状态,可以放牧和不可以放牧,可以放牧用1表示,否则用0表示,在这块牧场放牛,要求两个相邻的方格不能同时放牛,即牛与牛不能相邻.问有多少种放牛方案(一头牛都不放也是一种方案) 分析:每一行看做一个状态,用一个二进制数来表示,每一行会排出牛和牛相邻的情况:由上一行转移到下一行的条件就是这一行和上一行不会存在1在同一列,也就是与操作后为0, 状态表示: dp[state][i] 表示 在状态为state情况下第i行可以满足的方案数 状态转移:DP[s…