TopCoder

User's AC Ratio

78.9% (15/19)

Submission's AC Ratio

35.4% (17/48)

Tags

Description

給一個地雷盤面,問每格周圍八格有多少個地雷。

Input Format

第1行有兩個正整數 $n$ 和 $m$ $(1 \leq n,m \leq 100)$,代表著盤面的長和寬
第2行到第 $n$+1行,每行會有 $m$ 個數字,0 表示沒有地雷,1 表示有地雷。

Output Format

請輸出 $n$ 行,每行會有 $m$ 個數字,代表該格周圍八格有多少地雷

Sample Input 1

3 3
0 0 1
1 0 1
1 0 1

Sample Output 1

1 3 1
1 5 2
1 4 1

Hints

Problem Source

NEOJ Problem 214

Subtasks

No. Testdata Range Constraints Score
1 0 10
2 1 10
3 2 10
4 3 10
5 4 10
6 5 10
7 6 10
8 7 10
9 8 10
10 9 10

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 2
2 1000 65536 65536 3
3 1000 65536 65536 4
4 1000 65536 65536 5
5 1000 65536 65536 6
6 1000 65536 65536 7
7 1000 65536 65536 8
8 1000 65536 65536 9
9 1000 65536 65536 10