PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000212. Tìm giai thừa có đúng m chữ số 0 cuối (A Trivial Problem)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tìm giai thừa có đúng m chữ số 0 cuối (A Trivial Problem)
A Trivial Problem
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , find all nonnegative integers such that the decimal representation of has exactly trailing zero digits.
Print the number of solutions, followed by all solutions in increasing order. If no solution exists, print only 0.
Input
The only line contains the integer .
Output
On the first line, print the number of solutions. If positive, the second line contains all solutions in increasing order, separated by single spaces.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
1
Output
5
5 6 7 8 9
Explanation
has one trailing zero. Multiplication by introduces no additional factor , so also have exactly one trailing zero. At , the count becomes . Hence the five solutions are .