阿姆斯特朗数范围
C#
Medium
math
任务 «阿姆斯特朗数范围»
编写一个程序,在给定的从A到B(包含两端)的范围内找出所有阿姆斯特朗数。阿姆斯特朗数是指一个数等于其各位数字的幂次和,其中幂次等于该数的位数。例如,153 = 1^3 + 5^3 + 3^3。保证A ≤ B,且两个数均为正数且不超过100000。
输入格式
两个整数 A 和 B,以空格分隔。
输出格式
在区间 [A, B] 内的所有阿姆斯特朗数,每个数占一行。如果没有这样的数,则输出字符串 "No Armstrong numbers"。
示例
示例 1
输入
1 200
输出
1
2
3
4
5
6
7
8
9
153
示例 2
输入
3
1 3 5
4
2 4 6 8
number
输出
No Armstrong numbers
示例 3
输入
100 1000
输出
153
370
371
407
示例 4
输入
2
apple banana
3
cherry date elderberry
string
输出
apple banana cherry date elderberry
示例 5
输入
500 900
输出
No Armstrong numbers
main.cs