比较通用的方法:
class Solution { public: bool isPowerOfThree(int n) { if(n <= 0) return false; double res = log10(n) / log10(3); return (res - int(res) == 0) ? true : false; } };
https://www.cnblogs.com/zhoudayang/p/5126842.html
https://blog.csdn.net/xsloop/article/details/50731987