leetcode 326

3的幂

 1 class Solution {
 2 public:
 3     bool isPowerOfThree(int n) {
 4         double k;
 5         k=log10(n)/log10(3);
 6         if((int)k==k)
 7        return true;
 8        return false;
 9     }
10 };

 

posted @ 2016-08-08 15:29  HYDhyd  阅读(156)  评论(0编辑  收藏  举报