首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
求平方根
[编程题]求平方根
热度指数:159470
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
实现函数
int mysqrt(int x).
计算并返回 x 的平方根(向下取整)
数据范围:
要求:空间复杂度
,时间复杂度
示例1
输入
2
输出
1
示例2
输入
2143195649
输出
46294
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(18)
邀请回答
收藏(579)
分享
提交结果有问题?
0个回答
134篇题解
添加回答
这道题你会答吗?花几分钟告诉大家答案吧!
提交观点
问题信息
二分
基础数学
难度:
0条回答
579收藏
27537浏览
热门推荐
通过挑战的用户
查看代码
110020
2023-02-18 16:04:45
牛客62354...
2022-11-24 17:50:02
马孔多在下雨2022
2022-10-02 19:12:00
在做ppt的伊...
2022-09-19 10:32:38
苦行僧人
2022-09-18 22:55:29
相关试题
线段树编号问题
基础数学
评论
(2)
分组
基础数学
二分
评论
(11)
车站建造问题
基础数学
评论
(40)
PN结加正向电压时,空间电荷区将()。
模拟电路
评论
(1)
在放大电路中,抑制温漂的方法包括下...
模拟电路
评论
(1)
求平方根
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ public int mysqrt (int x) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ int mysqrt(int x) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 # @return int整型 # class Solution: def mysqrt(self , x ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ public int mysqrt (int x) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ function mysqrt( x ) { // write code here } module.exports = { mysqrt : mysqrt };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 # @return int整型 # class Solution: def mysqrt(self , x: int) -> int: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ func mysqrt( x int ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ int mysqrt(int x ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param x int整型 # @return int整型 # class Solution def mysqrt(x) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ def mysqrt(x: Int): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ fun mysqrt(x: Int): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ public int mysqrt (int x) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ export function mysqrt(x: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ func mysqrt ( _ x: Int) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return int整型 */ pub fn mysqrt(&self, x: i32) -> i32 { // write code here } }
2
1
2143195649
46294