All Tracks Basic Programming Implementation Basics of Implementation Problem

Trailing Zeroes in Factorial
Tag(s):

Medium-Hard

Problem
Editorial
Analytics

Mr. Yash asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among those great programmers who can solve this problem?

Input First line of input contains an integer T number of test cases. Each test case contains an integer M (1 ≤ M ≤ 100,000) — the required number of trailing zeroes in factorial.

Output First print k — the number of values of n such that the factorial of n ends with m zeroes. Then print these k integers in increasing order.

SAMPLE INPUT
1
1
SAMPLE OUTPUT
5
5 6 7 8 9
Time Limit: 5.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Parul University

Challenge Name

Code-Camp

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?