這題思考一下只要沾到邊是0的就表示不會感染
範例1
輸入:
X X X X X X X
X X X X X X X
X X X X X X X
X X X X X X X
X X X X X X X
X X 0 0 X X X
X X 0 X X X X
輸出:
X X X X X X X
X X X X X X X
X X X X X X X
X X X X X X X
X X X X X X X
X X 0 0 X X X
X X 0 X X X X
範例2
輸入:
X X X X X X X
X X X X X X X
X X X X X X X
X X 0 0 0 0 0
X X X X X X X
X X X X X X X
X X X X X X X
輸出:
X X X X X X X
X X X X X X X
X X X X X X X
X X 0 0 0 0 0
X X X X X X X
X X X X X X X
X X X X X X X
範例3
輸入:
X X X X 0 X X
0 0 0 X 0 X X
X X 0 0 X 0 X
X X X X X X X
X X X X X X X
X 0 0 0 0 0 X
X X X 0 X X X
輸出:
X X X X 0 X X
0 0 0 X 0 X X
X X 0 0 X I X
X X X X X X X
X X X X X X X
X 0 0 0 0 0 X
X X X 0 X X X
沒有留言:
張貼留言