PUCMM025 - Divisor Digits
Given a number, output how many digits of that number the number is itself divisible by. Count all occurrences of such digits in the number, not just the first.
For example, 12345 is divisible by 1, 3, and 5, so, the answer in this case must be 3.
Input
Each test case is a number between 1 and 10240.
Output
for each test case, output how many of its digits divide the number.
Example
Input: 12345 661232 312 730000000 Output: 3 3 3 0
hide comments
Rishabh Joshi:
2015-05-28 12:01:56
string data type will give TLE due to slower input output (as dynamic mem allocation is involved) suggested using char[] and scanf/printf. |
|
Arnab Mitra:
2015-05-27 22:08:33
Easy if you can figure out a way to deal with divisibility with 7 |
|
Raj Kumar Chauhan:
2015-02-11 11:28:54
killing lot of time , problem is with 7 . and also do care of variables. |
|
lovecode:
2015-01-18 11:13:01
only issue is with 7 otherwise easy......... |
|
Ash:
2015-01-13 15:10:38
all those getting WA try running your code for for small prime multiples of seven |
|
Ranjan Kumar Singh:
2014-07-08 17:03:13
just do it!!! |
|
ivar.raknahs:
2014-05-10 13:08:02
getting WA again and again
|
|
agaurav77:
2014-05-09 19:48:28
Focus on EOF and divisibility rules. |
|
Unknown:
2014-04-19 12:44:10
150 on SPOJ !!! |
|
GOKU:
2014-03-07 15:39:41
wrong answer why!!!!
|
Added by: | Olson Ortiz |
Date: | 2011-12-08 |
Time limit: | 0.207s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP JAVA |
Resource: | Used in 2da Olimpiada de Programacion PUCMM-ACM-ISC (fase 2) |