Find The Digits
All submissions for this problem are available.
Given an integer, , traverse its digits (1,2,...,n) and determine how many digits evenly divide (i.e.: count the number of times divided by each digit i has a remainder of ). Print the number of evenly divisible digits.
Note: Each digit is considered to be unique, so each occurrence of the same evenly divisible digit should be counted (i.e.: for , the answer is ).
The first line is an integer, , indicating the number of test cases.
The subsequent lines each contain an integer, .
For every test case, count and print (on a new line) the number of digits in that are able to evenly divide .
2 12 1012
The number is broken into two digits, and . When is divided by either of those digits, the calculation's remainder is ; thus, the number of evenly-divisible digits in is .
The number is broken into four digits, , , , and . is evenly divisible by its digits , , and , but it is not divisible by as division by zero is undefined; thus, our count of evenly divisible digits is .
|Tags||easy, hrupanjan, math, solution|
|Time Limit:||1 sec|
|Source Limit:||5000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, RUBY, NODEJS, FORT, JS, TEXT, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.