跳至主要内容

326. 3的幂

class Solution {
public:
    bool isPowerOfThree(int n) {
        while (n > 0)
        {
            if (n == 1)
                return true;
            if (n % 3 != 0)
                return false;
            n /= 3;
        }
        return false;
    }
};

评论

此博客中的热门博文

shadowsocks android编译

git clone https://github.com/shadowsocks/shadowsocks-android.git cd shadowsocks-android git submodule update --init --recursive chmod a+rwx ./ -R docker run --rm -v ${PWD}:/build -w /build shadowsocks/android-ndk-go ./gradlew assembleDebug