Power of Three(C++3的幂)

解题思路:code (1)注意1也是3的幂io (2)依次判断可否被3整除,而且同时更新n = n / 3class class Solution { public: bool isPowerOfThree(int n) { if(n<1) return false; if(n==1) return true; while(n!=1) {
相关文章
相关标签/搜索