英文题面翻译(19)

该程序旨在找出一个特殊数字序列的第n个元素,该序列由仅包含质因数2、3、5或7的数字组成。输入为正整数n,输出为序列中的第n个不起眼数字,并以正确的序数词形式显示。例如,第100个不起眼的数字是450。示例涵盖了从1到5842的测试用例,最后以0结束输入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

英文题面:

http://noi.openjudge.cn/ch0405/1249/

翻译:

描述

唯一质因数为 2、3、5 或 7 的数字称为不起眼的数字。序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ...显示了前 20 个不起眼的数字。

编写一个程序来查找并打印此序列中的第 n 个元素。

输入

输入由一个或多个测试用例组成。每个测试用例由一个整数 n 组成,其中 1 <= n <= 5842。对于 n,输入由零的值终止。

输出

对于每个测试用例,打印一行,上面写着"第 n 个不起眼的数字是数字"。根据 n 的值,必须使用序数 nth 的正确后缀"st"、"nd"、"rd"或"th",如示例输出中所示。

样例输入

1

2

3

4

11

12

13

21

22

23

100

1000

5842

0

样例输出

The 1st humble number is 1.

The 2nd humble number is 2.

The 3rd humble number is 3.

The 4th humble number is 4.

The 11th humble number is 12.

The 12th humble number is 14.

The 13th humble number is 15.

The 21st humble number is 28.

The 22nd humble number is 30.

The 23rd humble number is 32.

The 100th humble number is 450.

The 1000th humble number is 385875.

The 5842nd humble number is 2000000000

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值