|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
We are given a game board consisting of squares arranged in N rows and N columns, with each square containing a single non-negative integer
In the beginning of the game, a piece is situated on the top-left square (1,1) and it has to get to the bottom-right square (N,N) only moving one-square-down or one-square-to-the-right in each step. Furthermore, a piece can not be placed on a square containing number 0.
We define the cost of a path to be the product of all the numbers on that path.
We say that some path is optimal if number of zeros at the end of decimal representation of its cost is minimal.
Write a program that will calculate the number of zeros at the end of the decimal representation of cost of optimal path.
First line of input contains the integer N, 1 ≤ N ≤ 1000.
Each of the following N lines contains N numbers. These numbers represent the board from the problem statement. All the numbers will be non-negative integers less than or equal to 1,000,000.
Note: there will always be solution for each test data.
First and only line of output should contain the number of zeros from the problem statement.
3 5 7 6 4 0 1 3 2 5
3 1 2 3 4 5 6 7 8 9
4 1 3 0 0 0 8 2 25 6 5 0 3 0 15 7 4