Given three integers the lower range L ,the upper range U and a digit M. The task is to count all the numbers between L and U such that the number is divisible by M and also, it does not contain the digit M.
Input: M = 9 ,L = 16 , U = 26 Output: 1 Explanation: Within this given range ,the number that follows the above two given conditions is: 18 . Input: M = 6 ,L = 88 , U = 102 Output: 2 Explanation: Within this given range ,the numbers that follows the above two given conditions are: 90 and 102 .
- The idea is to iterate from the lower range(L) to the upper range(U) and for each number,
- we will store the distinct digits of the number in a num variable and will check if the set contains the digit M or not as per the given conditions. If the number does not contain the given digit M and is divisible by M, then the counter is incremented by 1.
- Count numbers in a range with digit sum divisible by K having first and last digit different
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Count numbers divisible by K in a range with Fibonacci digit sum for Q queries
- Count of Numbers in Range where first digit is equal to last digit of the number
- Queries to count integers in a range [L, R] such that their digit sum is prime and divisible by K
- Count of Numbers in a Range where digit d occurs exactly K times
- Count numbers in a range that are divisible by all array elements
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Sum of all N-digit palindromic numbers which doesn't contains 0 and are divisible by 9
- Sum of all N digit palindromic numbers divisible by 9 formed using digits 1 to 9
- Find two numbers made up of a given digit such that their difference is divisible by N
- Numbers that are not divisible by any number in the range [2, 10]
- No of pairs (a[j] >= a[i]) with k numbers in range (a[i], a[j]) that are divisible by x
- Queries for count of even digit sum elements in given range using MO's Algorithm
- Queries for the count of even digit sum elements in the given range using Segment Tree.
- Count integers in a range which are divisible by their euler totient value
- Count of numbers upto M divisible by given Prime Numbers
- Count numbers from 1 to n that have 4 as a digit
- Count of all N digit numbers such that num + Rev(num) = 10^N - 1
- Count numbers with exactly K non-zero digits and distinct odd digit sum
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.