43. Power Calculator

Acceptance — 0 accepted 0 submissions

Easy
LoopsMath
No companies listed
A bacteria colony multiplies a times every hour. Starting with 1 bacterium, how many will there be after b hours?

Compute a raised to the power b using a loop. Don't use the built-in power function.

Input Format
A single line with two integers a and b.

Output Format
Print a^b. Take 0^0 as 1.

Constraints
• 0 ≤ a ≤ 10
• 0 ≤ b ≤ 18
• The answer fits in 10^18 (use long long or long).

Example 1

Input
2 10
Output
1024

Explanation 2 multiplied 10 times = 1024.

Example 2

Input
5 0
Output
1

Explanation Anything to the power 0 is 1.

Example 3

Input
3 4
Output
81

Explanation 3 × 3 × 3 × 3 = 81.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
1024
No results yet
Run your code to test it against the sample cases.
Problem List