News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(8)

Huawei OD Machine Test Paper E - Narcissus Mathematics I (Java & Python & JS & C++ & C )

posted on 2024-11-02 14:34     read(684)     comment(0)     like(17)     collect(0)


Latest Huawei OD machine test

Exam Questions Catalog: Click here to view the catalog
Huawei OD Interview Exam Questions Selection: Click here to view now

Title Description

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.

Enter a description

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.

Output Description

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.

Example 1

enter

3
0
<


Category of website: technical article > Blog

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.

17 0
collect article
collected

Comment content: (supports up to 255 characters)