Problem Statement
Choose a number between 1 and 9, inclusive. Multiply it by 3. Add 3 to it. Multiply it again by 3. Sum its digits. You got 9, right?
Elly was intrigued by this "magic trick" (that is actually just pure number theory). She now wants to generalize it. In her version you should initially choose a number between 1 and N, inclusive, then you should multiply it by X, add Y, multiply that result by Z, and finally sum the digits of the number you got. If all choices of the initial number lead to the same final result, the girl is satisfied by the triplet (X, Y, Z).
Elly will only consider X, Y, and Z which are positive integers between 1 and 50, inclusive - otherwise the calculations become too difficult for her taste. There is no restriction on whether X, Y, and Z should be equal or not. In the example above X = Y = Z = 3, but (X = 9, Y = 9, Z = 5), (X = 10, Y = 1, Z = 9), or (X = 42, Y = 48, Z = 33) also work for N = 9.
Let's consider the last example in more detail. You may choose any starting value between 1 and 9, inclusive. Suppose you chose the starting value 3. First you multiply it by 42, which gives you 126. Then you add 48, which gives you 174. In the third step you multiply that by 33, getting 5742. Your final answer is the sum of digits of 5742, which is 5+7+4+2 = 18. Starting from the value 1 gives us 1*42 = 42, 42+48 = 90, 90*33 = 2970, and 2+9+7+0 = 18. Similarly, each of the seven other possible starting values produces the final answer 18.
Given the
Definition
- Class:
- EllysWhatDidYouGet
- Method:
- getCount
- Parameters:
- int
- Returns:
- int
- Method signature:
- int getCount(int N)
- (be sure your method is public)
Constraints
- N will be an integer between 1 and 100, inclusive.
Examples
9
Returns: 952
5
Returns: 3515
13
Returns: 456
42
Returns: 149
1
Returns: 125000
2
Returns: 15486
3
Returns: 8941
4
Returns: 5582
6
Returns: 2339
7
Returns: 1683
8
Returns: 1246
10
Returns: 682
11
Returns: 514
12
Returns: 482
14
Returns: 431
15
Returns: 404
16
Returns: 377
17
Returns: 359
18
Returns: 336
19
Returns: 324
20
Returns: 303
21
Returns: 296
22
Returns: 286
23
Returns: 279
24
Returns: 271
25
Returns: 256
26
Returns: 248
27
Returns: 238
28
Returns: 231
29
Returns: 228
30
Returns: 222
31
Returns: 220
32
Returns: 215
33
Returns: 203
34
Returns: 194
35
Returns: 185
36
Returns: 176
37
Returns: 175
38
Returns: 173
39
Returns: 164
40
Returns: 151
41
Returns: 150
43
Returns: 146
44
Returns: 142
45
Returns: 135
46
Returns: 133
47
Returns: 131
48
Returns: 126
49
Returns: 115
50
Returns: 101
51
Returns: 96
52
Returns: 88
53
Returns: 88
54
Returns: 88
55
Returns: 88
56
Returns: 88
57
Returns: 88
58
Returns: 87
59
Returns: 84
60
Returns: 78
61
Returns: 78
62
Returns: 78
63
Returns: 78
64
Returns: 78
65
Returns: 78
66
Returns: 78
67
Returns: 78
68
Returns: 78
69
Returns: 78
70
Returns: 75
71
Returns: 75
72
Returns: 75
73
Returns: 75
74
Returns: 75
75
Returns: 75
76
Returns: 75
77
Returns: 75
78
Returns: 74
79
Returns: 73
80
Returns: 69
81
Returns: 69
82
Returns: 69
83
Returns: 69
84
Returns: 69
85
Returns: 68
86
Returns: 67
87
Returns: 66
88
Returns: 65
89
Returns: 63
90
Returns: 60
91
Returns: 59
92
Returns: 58
93
Returns: 56
94
Returns: 54
95
Returns: 52
96
Returns: 48
97
Returns: 41
98
Returns: 33
99
Returns: 22
100
Returns: 2