B. 练65.2 跳房子

    Type: Default 1000ms 16MiB

练65.2 跳房子

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

The cows are playing a non-traditional version of the children's "hopscotch" game. Instead of a linear arrangement of numbered squares, they have created a 5×55 \times 5 grid of numbers, aligned with the xx and yy axes. The cows skillfully jump from number to number in the grid: forward, backward, left, or right (never diagonally), landing on another number in the grid. They continue jumping (using the same rules), possibly landing on numbers they've already visited. After a total of five jumps, their path forms a six-digit integer (which may start with 00, e.g., 000201000201). Find the total number of distinct integers that can be formed in this way.

Input Format

Lines 11 to 55: The grid, each line contains 55 integers.

Output Format

Line 11: The total number of distinct integers that can be formed.

Sample

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 2 1
1 1 1 1 1
15

20251122 C班作业(7)

Not Claimed
Status
Done
Problem
2
Open Since
2025-11-22 0:00
Deadline
2025-11-30 23:59
Extension
24 hour(s)