LeetCode 326. Power of Three

题目

class Solution {
public:
    bool isPowerOfThree(int n) {
    
    double x = log10(n) / log10(3);

        return  n>0 && (abs((int)x - x) < 0.000000000000001);
    }
};
posted @ 2020-07-09 15:22  Shendu.CC  阅读(123)  评论(0编辑  收藏  举报