#CCBCHBA0000036. Tính lũy thừa nguyên (Integer Power)
Tính lũy thừa nguyên (Integer Power)
Integer Power
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given integer a and a nonnegative exponent b, calculate a to the power b with a for loop. Define 0^0 = 1 as the empty product.
Input
Integers a b with -20<=a<=20, 0<=b<=12; the result fits signed 64-bit.
Output
One integer a^b.
Subtasks
- Subtask 1 (20%): |a|<=5, b<=4.
- Subtask 2 (30%): |a|<=10, b<=8.
- Subtask 3 (50%): |a|<=20, b<=12.
Examples
Example 1
Input
2 5
Output
32
Explanation
Starting at 1, multiply by 2 five times.
Example 2
Input
0 0
Output
1
Explanation
No multiplication takes place; the accumulator stays at 1.