Easy-题目69:342. Power of Four(增补2)

题目原文:
Given an integer, write a function to determine if it is a power of four.
题目大意:
给出一个整数,判断是不是4的幂。
题目分析:
懒得写了,穷举。
源码:(language:cpp)

class Solution {
public:
    bool isPowerOfFour(int n) {
        return (n==1||n==4||n==16||n==64||n==256||n==1024||n==4096||n==16384||n==65536||n==262144||n==1048576||n==4194304||n==16777216||n==67108864||n==268435456||n==1073741824);
    }
};

成绩:
20ms

你可能感兴趣的:(Easy-题目69:342. Power of Four(增补2))