#include <iostream> using namespace std; int main() { int T; scanf("%d",&T); while(T) { int m,n; scanf("%d",&n); int count=0; for(int i=5; ;i=i+5) { m=i; while(m%5==0 && m>0) { m=m/5; count++; if(count==n) { break; } } if(count==n) { printf("%d",i); break; } } printf("\n"); } return 0; }
Problem Description
Given a number n. The task is to find the smallest number whose factorial contains at least n trailing zeroes.
Examples:
Input : n = 1
Output : 5
1!, 2!, 3!, 4! does not contain trailing zero.
5! = 120, which contains one trailing zero.
Input : n = 6
Output : 25
25! = 15511210043330985984000000
Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer n.
Output:
For each test case in a new line print the required output.
Constraints:
1<=T<=100
1<=n<=100

Test Case 1
Input (stdin)
2 1 6
Expected Output
5 25

Test Case 2
Input (stdin)
3 2 5
Expected Output
10 25 25