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) {
相關文章
相關標籤/搜索