Problem4395--寻找2020

4395: 寻找2020

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。

小蓝有一个数字矩阵,里面只包含数字 lns="http://www.w3.org/1998/Math/MathML">0 和 lns="http://www.w3.org/1998/Math/MathML">2。小蓝很喜欢 lns="http://www.w3.org/1998/Math/MathML">2020,他想找 到这个数字矩阵中有多少个 lns="http://www.w3.org/1998/Math/MathML">2020 。 小蓝只关注三种构成 lns="http://www.w3.org/1998/Math/MathML">2020 的方式:

  1. 同一行里面连续四个字符从左到右构成 lns="http://www.w3.org/1998/Math/MathML">2020

  2. 同一列里面连续四个字符从上到下构成 lns="http://www.w3.org/1998/Math/MathML">2020

  3. 在一条从左上到右下的斜线上连续四个字符,从左上到右下构成 lns="http://www.w3.org/1998/Math/MathML">2020

    例如,对于下面的矩阵:

    220000
    000000
    002202
    000000
    000022
    002020  
    		

    一共有 lns="http://www.w3.org/1998/Math/MathML">5 个 lns="http://www.w3.org/1998/Math/MathML">2020。其中 lns="http://www.w3.org/1998/Math/MathML">1 个是在同一行里的,lns="http://www.w3.org/1998/Math/MathML">1 个是在同一列里的,lns="http://www.w3.org/1998/Math/MathML">3 个 是斜线上的。

小蓝的矩阵比上面的矩阵要大,如下给出了小蓝的矩阵。

请帮助小蓝确定在他的矩阵中有多少个 2020。

本题数据太长找刘老师要数据

Source/Category