首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
2的幂
[编程题]2的幂
热度指数:1860
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
给定一个非负整数 n ,请问是否存在一个 x 满足
,如果有,则返回 true ,否则返回 false
数据范围:
示例1
输入
4
输出
true
说明
示例2
输入
6
输出
false
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(11)
分享
纠错
提交结果有问题?
0个回答
11篇题解
添加回答
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
位运算
基础数学
递归
难度:
0条回答
11收藏
2044浏览
热门推荐
通过挑战的用户
查看代码
worldfa...
2023-03-04 18:49:28
牛客67497...
2022-09-14 14:04:34
半个西瓜半个夏
2022-09-13 14:14:01
皮卡皮卡皮卡皮卡丘
2022-09-12 22:12:30
讨啄的白菜
2022-09-11 00:19:41
相关试题
牛牛的超市
动态规划
基础数学
评论
(5)
Primary Arithmetic
字符串
基础数学
位运算
评论
(39)
车站建造问题
基础数学
评论
(40)
设某二叉树的先序遍历序列为abdg...
树
评论
(1)
2022 诺瓦科技 Perl re...
perl
System Verilog
评论
(1)
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ public boolean poweroftwo (int n) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ bool poweroftwo(int n) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @return bool布尔型 # class Solution: def poweroftwo(self , n ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ public bool poweroftwo (int n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ function poweroftwo( n ) { // write code here } module.exports = { poweroftwo : poweroftwo };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @return bool布尔型 # class Solution: def poweroftwo(self , n: int) -> bool: # write code here
package main //import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ func poweroftwo( n int ) bool { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ bool poweroftwo(int n ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @return bool布尔型 # class Solution def poweroftwo(n) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ def poweroftwo(n: Int): Boolean = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ fun poweroftwo(n: Int): Boolean { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ public boolean poweroftwo (int n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ export function poweroftwo(n: number): boolean { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ func poweroftwo ( _ n: Int) -> Bool { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param n int整型 * @return bool布尔型 */ pub fn poweroftwo(&self, n: i32) -> bool { // write code here } }
4
true
6
false