LeetCode 326. Power of Three
2016-07-12 16:52
218 查看
Given an integer, write a function to determine if it is a power of three.
Follow up:
Could you do it without using any loop / recursion?
power of three = 3的幂
Follow up:
Could you do it without using any loop / recursion?
power of three = 3的幂
class Solution { public: bool isPowerOfThree(int n) { double res = log10(n) / log10(3); if((res - (int)res) == 0) return true; return false; } };
相关文章推荐
- html使用iframe实现伪异步表单,实现无刷新上传文件时遇到的问题
- BitmapFactory.decodeResource(res, id); 第一个参数跟第二个参数有什么关系?
- Sort List
- go strings 常用的几个函数
- NetBeans 中文输入法词语候选区不跟随光标
- 从 Java 代码逆向工程生成 UML 类图和序列图
- logback 配置详解(一)
- html中map热点使用说明
- 练习----基于ip的虚拟主机设置
- apache commons fileupload Clirr结果(2016-07-01更新)
- 网络爬虫(二):利用urllib2通过指定的URL抓取网页内容
- C++构造与析构类与类中的指针对象
- Audio
- java 实现发送邮件
- ListView & RecyclerView播放视频
- Gson全解析(上)
- Qt 学习之路 2笔记4
- Android Studio导入第三方类库的方法(转)
- android Application类的详细介绍(转)
- 解决eclipse Debug时提示source not found的问题