bomb explode
Submit solution
Points:
10 (partial)
Time limit:
1.0s
Memory limit:
256M
Authors:
Problem type
Allowed languages
Java 19, Java 8
題目說明
輸入一個5*5的矩陣,其中僅包含0和1,1代表炸彈
輸入一整數n,n為炸彈的爆炸範圍,炸彈僅會上下左右爆炸(沒有斜的),爆炸範圍為炸彈的上下左右n格
請將炸彈爆炸後的範圍(包含炸彈本身)改為1,其餘保持為0,輸出新的矩陣
下圖為爆炸範圍為1的圖:
輸入
5*5矩陣 爆炸範圍
輸出
爆炸後的5*5矩陣
sample input1
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
sample output1
0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1
Comments
輸入數據有誤