Problem:-
You are given a number n.
A supernatural number is a number whose product of digits is equal to n, and in this number there is no digit 1.
Count the number of supernatural numbers for a given n.
Input
Contains a single integer n, 1 <= n <= 100.
Output
Print the number of supernatural numbers.
There are only two natural numbers, the product of the digits of which is 4 - 4, 22.
Logic:-
Here constrains for n is :- n<=100 so multiplication of digits of a number should be less than 100;
and 1 should not in supernatural number (according to question) so the minimum number is 2.
and when we multiply 2
2=2
2*2=4
2*2*2=8
2*2*2*2=16
2*2*2*2*2=32
2*2*2*2*2*2=64
2*2*2*2*2*2*2=128 (which is greater then 100)
So the maximum length of the number is 6.
and we have to check from 2 to 1000000 (maximum number) for all the number .
Code:-
- Very Cool numbers | Hacker earth solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem
Data structure:-
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree
Key points:-
- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier
0 Comments