D.P problem (The least round way).

Revision en1, by rr459595, 2018-06-13 09:43:47

Here is the link to the problem:- http://mirror.codeforces.com/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 0 by path (3-5-1-5).

How to decide which number should I pick at cell 2 so that it doesn't affect the future cell ?

Thanks.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English rr459595 2018-06-13 09:46:55 4
en2 English rr459595 2018-06-13 09:45:12 12
en1 English rr459595 2018-06-13 09:43:47 644 Initial revision (published)