B. Find the Spruce 题意 给你一个n×m的矩阵,每个位置都有一个’‘或者’.‘,现在定义一个目标图案,如下图: 只有类似上面的这种才行,现在问你给你的n×m的矩阵中,有多少个这样的图案。 思路 dp 我们设一个二维数组dp[i][j],表示以(i,j)这个结尾有多少个连续的’‘。然后我们可以以任何一个(i,j)为’‘的位置开始找,那么我们可以直接遍历一遍图,我们观察上面的图可以发
Holidays are coming up really soon. Rick realized that it’s time to think about buying a traditional spruce tree. But Rick doesn’t want real trees to get hurt so he decided to find some in an n×m matr
Holidays are coming up really soon. Rick realized that it’s time to think about buying a traditional spruce tree. But Rick doesn’t want real trees to get hurt so he decided to find some in an n×m matr
此处传送门 Christmas Spruce time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Consider a rooted tree. A rooted tree has one special vertex calle