326. Power of Three

来源:互联网 发布:web软件开发方式 编辑:程序博客网 时间:2024/06/05 04:29

http://www.cnblogs.com/boluo007/p/5513386.html

凡是3的幂都会被整数范围内的最大幂的值整除

1 bool isPowerOfThree(int n) {2     // 1162261467 is 3^19,  3^20 is bigger than int  3     return ( n>0 and  1162261467%n==0);4 }

原创粉丝点击