#210. 递归计算整数幂
递归计算整数幂
Power Calculation
Background
Congcong is learning about exponentiation in mathematics. He wants to write a program to calculate the power of a number, but he is required to use recursion only, without using loops.
Problem Description
Given two positive integers and , both of which are or more. Compute recursively (no loops) the value of to the -th power. For example, is ( squared).
Input Format
Input is given from Standard Input in the following format.
Output Format
Output is printed to Standard Output in the following format.
The calculated result of
Sample
3 1
3
3 2
9
3 3
27
Sample Explanation
For the first sample, input means calculating , and the result is . For the second sample, input means calculating , and the result is . For the third sample, input means calculating , and the result is .
Constraints
For all test cases:
- Time limit: second
- Memory limit: MiB