Here is the link to the problem:- http://codeforces.net/problemset/problem/2/B
If we have input matrix(2 rows and 3 columns) as:-
2 3
3 4 5
5 1 5
If we take 1-indexing, then at cell (2,2), we have 2 choices to get 0 number of trailing zeroes. One is (3*4*1) or (3*5*1). But we if we take (3*4*1)=12, then at the end cell (3,3), minimum number of trailing zeroes will be 1(by path 3-4-1-5). If we take 15 at cell 2, minimum number of trailing zeroes at the end will be 0 by path (3-5-1-5).
How to decide which number should I pick at cell (2,2) so that it doesn't affect the future cell (3,3)?
Thanks.