Given a number N. The task is to find the count of numbers which have N digits and even number of zeroes.
Note: The number can have preceding 0’s.
Input: N = 2 Output: Count = 81 Total 2 digit numbers are 99 considering 1 as 01. 2 digit numbers are 01, 02, 03, 04, 05.... 99 Numbers with odd 0's are 01, 02, 03, 04, 05, 06, 07, 08, 09 10, 20, 30, 40, 50, 70, 80, 90 i.e. 18 The rest of the numbers between 01 and 99 will do not have any zeroes and zero is also an even number. So, numbers with even 0's are 99 - 18 = 81. Input: N = 3 Output: Count = 755
Approach: The idea is to find the Count Numbers with N digits which consists of odd number of 0’s and subtract it from the total number with N digits to get the number with even 0’s.
Note: Answer can be very large, so for N greater than 9, use modular exponentiation.
- Count Numbers with N digits which consists of odd number of 0's
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Count of Numbers in Range where the number does not contain more than K non zero digits
- Count of Numbers such that difference between the number and sum of its digits not less than L
- Count the number of digits of palindrome numbers in an array
- Count total number of N digit numbers such that the difference between sum of even and odd digits is 1
- Smallest multiple of 3 which consists of three given non-zero digits
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Count numbers with same first and last digits
- Count of numbers from range [L, R] whose sum of digits is Y
- Count numbers formed by given two digit with sum having given digits
- Count different numbers that can be generated such that there digits sum is equal to 'n'
- Count of n digit numbers whose sum of digits equals to given sum
- Count different numbers possible using all the digits their frequency times
- Count numbers in range L-R that are divisible by all of its non-zero digits
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.