#C2951. Integer Exponentiation
Integer Exponentiation
Integer Exponentiation
Given two non-negative integers base
and exponent
, compute the result of raising the base to the power of the exponent, i.e. \(base^{exponent}\). In particular, note that when both base
and exponent
are zero, the answer is defined as 1.
Examples:
- Input: 2 3, Output: 8
- Input: 5 0, Output: 1
- Input: 0 3, Output: 0
Your task is to implement this computation. Ensure the program reads input from standard input (stdin
) and outputs the answer to standard output (stdout
).
inputFormat
The input consists of a single line containing two non-negative integers separated by spaces. The first integer represents the base and the second integer represents the exponent.
outputFormat
Output a single integer: the result of (base^{exponent}) computed according to the rules described, with the special case (0^0 = 1).## sample
2 3
8