Problem Statement | |||||||||||||
We need to know the k-th digit in x to the power y. A value of 0 for
k means that the digit of interest is the rightmost digit, a value of 1 means
the digit next to the rightmost digit, etc.
Create a class PowerDigit that contains a method digitK that is given x, y, and k and that returns the k-th digit (an integer in the range 0 to 9 inclusive) in x to the power y. If there is no k-th digit in x to the power y return -1. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | x is between 0 and 10,000, inclusive. | ||||||||||||
- | y is between 1 and 10,000, inclusive. | ||||||||||||
- | k is between 0 and 4, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|