练46.2 求丑数
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
We call a number "ugly" if it only contains factors , , and . For example, and are ugly numbers, but is not because it contains factor . By convention, we consider as the first ugly number.
First, define a function to determine if a number is ugly, then use it to output all ugly numbers between and , and count their total number.
Input Format
None
Output Format
The output consists of two parts:
First part: Output all ugly numbers between and , with integers per line, each integer taking up characters.
Second part: First output "Count: ", then output the total number of ugly numbers between and .
Sample
None 1 2 3 4 5 6 8 9 10 12
15 16 18 20 24 25 27 30 32 36
40 45 48 50 54 60 64 72 75 80
81 90 96 100
个数:34
20251025B班作业(4)
- Status
- Done
- Problem
- 4
- Open Since
- 2025-10-25 0:00
- Deadline
- 2025-11-2 23:59
- Extension
- 24 hour(s)