Contest Contest Page | CodeChef
Editorialist: Ravit Singh Malik ravit007 | CodeChef User Profile for Ravi T. | CodeChef
You are required to find the number of trailing zeroes of F(n) = 1^12^23^3*…*N^N,
QUICK EXPLANATIONsuppose uou have to find the number of zeroes in a product. 24*32*23*19=( 2^3*3^1)*2^5*23*19 as you can notice, this product will have no zeroes because it has no 5 in it.
however, if you have expression like: 81523172522
it is equal to 2^33^15^123175^22^111^1
Zeroes are formed by the cobination of 2*5. Hence,the number of zeroes will depend on number of pairs
of 2’s and 5’s that can be formed.
In the above product, there are four twos and three fives.Hence, ther will be 3 Zeroes in the product.
In the given problem You are required to find the number of trailing zeroes of F(n) = 1^12^23^3*…*N^N,
so, if n=32
F(n) = 1^12^23^3*…32^32,
so,the fives will be less than twos. Hence, we need to count only the fives.
give us: 5+10+15+20+25+25+30
we take 25 two times because it have two fives each.
thus the f(n) has 130 trailing zeroes.
input test cases t
begin of loop
end of loop