Connection Status:
Competition Arena > DivisorDigits
SRM 148 · 2003-05-28 · by chogyonim · Simple Math, String Manipulation
Class Name: DivisorDigits
Return Type: int
Method Name: howMany
Arg Types: (int)
Problem Statement

Problem Statement

Create a class DivisorDigits containing a method howMany which takes an int number and returns how many digits in number divide evenly into number itself.

Notes

  • No number is divisible by 0.

Constraints

  • number will be between 10000 and 999999999.
Examples
0)
12345
Returns: 3

12345 is divisible by 1, 3, and 5.

1)
33333
Returns: 5
2)
661232
Returns: 3

661232 is divisible by 1 and 2.

3)
52527
Returns: 0

52527 is not divisible by 5, 2, or 7.

4)
98765
Returns: 1
5)
730000000
Returns: 0

Nothing is divisible by 0. In this case, the number is also not divisible by 7 or 3.

Submissions are judged against all 37 archived test cases, of which 6 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class DivisorDigits with a public method int howMany(int number) · 37 test cases · 2 s / 256 MB per case

Submitting as anonymous