posted on 2024-11-02 14:34 read(684) comment(0) like(17) collect(0)
Exam Questions Catalog: Click here to view the catalog
Huawei OD Interview Exam Questions Selection: Click here to view now
The so-called daffodil number refers to an n-digit positive integer whose nth power sum of its digits is equal to the number itself.
For example, 153 is a daffodil number, 153 is a 3-digit number, and 153 = 1^3 + 5^3 + 3^3.
The first line contains an integer n, which is a positive integer with n digits. n is between 3 and 7, including 3 and 7.
The second line enters a positive integer m, indicating that the mth daffodil number needs to be returned.
Returns the number of the mth daffodil with length n. The numbers start from 0.
If m is greater than the number of daffodil numbers, return the product of the last daffodil number and m.
If the input is invalid, -1 is returned.
enter
3
0
<
Author:gfg
link:http://www.pythonblackhole.com/blog/article/245814/0ad42a2300ab45618c4c/
source:python black hole net
Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.
name:
Comment content: (supports up to 255 characters)
Copyright © 2018-2021 python black hole network All Rights Reserved All rights reserved, and all rights reserved.京ICP备18063182号-7
For complaints and reports, and advertising cooperation, please contact vgs_info@163.com or QQ3083709327
Disclaimer: All articles on the website are uploaded by users and are only for readers' learning and communication use, and commercial use is prohibited. If the article involves pornography, reactionary, infringement and other illegal information, please report it to us and we will delete it immediately after verification!