Can anyone please tell me how to go into the problem.I really could not understand what is asked in factorial question.Can anyone plz explain me in detail so that i’ll understand the further problems.But i understood the answer framed by others,but i could not understand the relation betwen the question and answer.Iam a newbie plz help me,i would like to solve some questions in codechef on my own.Iam really afraid of my skills.plz
Very first, don’t be afraid of your knowledge. Always try spreading it and enhancing it, that’s the only way one can learn. Secondly, the question says, you are given a number n, in the number n!, how many trailing zeroes are there. You need to compute the number of these zeroes. EX: n=5, 5!=120, only one trailing zero exists. Now, you are given several n i.e. test cases and you have to answer for each.
6 // no. of test cases 3 // first value of n, n!=6 here no zeroes and hence answer is 0 60 100 1024 23456 8735373
So, this is the question, to give you the logic of same, its a widely known technique that number of trailing zeroes in n! are:
|_n/5_| + |_n/25_| + |_n/125_| +... till n/(5^i) becomes zero. This is what is done in the solution.
So, take it easy and work hard and improve skill. Don’t be afraid of you weakness. Happy coding…
thank u so much