#t215. 计算 2 的幂
计算 2 的幂
Power of 2
Problem Description
Given a non-negative integer , compute .
Input Format
One integer ().
Output Format
One integer: raised to the -th power.
Sample Input
3
Sample Output
8
Hint
- In C++,
^is not exponentiation — it is the bitwise XOR operator, so using it is guaranteed wrong. - is at most , and , while the upper bound of
intis — off by exactly ! Think about which type is safe to use. - The approach is simply to multiply by a total of times.