{"id":2345,"date":"2022-01-24T11:59:49","date_gmt":"2022-01-24T03:59:49","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2345"},"modified":"2022-01-24T11:59:49","modified_gmt":"2022-01-24T03:59:49","slug":"leetcodeday69","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/01\/24\/leetcodeday69\/","title":{"rendered":"leetcodeday69 &#8211;\u6c42sqrt"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e00\u4e2a\u975e\u8d1f\u6574\u6570&nbsp;<code>x<\/code>&nbsp;\uff0c\u8ba1\u7b97\u5e76\u8fd4\u56de&nbsp;<code>x<\/code>&nbsp;\u7684&nbsp;<strong>\u7b97\u672f\u5e73\u65b9\u6839<\/strong>&nbsp;\u3002<\/p>\n\n\n\n<p>\u7531\u4e8e\u8fd4\u56de\u7c7b\u578b\u662f\u6574\u6570\uff0c\u7ed3\u679c\u53ea\u4fdd\u7559&nbsp;<strong>\u6574\u6570\u90e8\u5206&nbsp;<\/strong>\uff0c\u5c0f\u6570\u90e8\u5206\u5c06\u88ab&nbsp;<strong>\u820d\u53bb \u3002<\/strong><\/p>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u4e0d\u5141\u8bb8\u4f7f\u7528\u4efb\u4f55\u5185\u7f6e\u6307\u6570\u51fd\u6570\u548c\u7b97\u7b26\uff0c\u4f8b\u5982&nbsp;<code>pow(x, 0.5)<\/code>&nbsp;\u6216\u8005&nbsp;<code>x ** 0.5<\/code>&nbsp;\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165\uff1a<\/strong>x = 4\n<strong>\u8f93\u51fa\uff1a<\/strong>2<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165\uff1a<\/strong>x = 8\n<strong>\u8f93\u51fa\uff1a<\/strong>2\n<strong>\u89e3\u91ca\uff1a<\/strong>8 \u7684\u7b97\u672f\u5e73\u65b9\u6839\u662f 2.82842..., \u7531\u4e8e\u8fd4\u56de\u7c7b\u578b\u662f\u6574\u6570\uff0c\u5c0f\u6570\u90e8\u5206\u5c06\u88ab\u820d\u53bb\u3002<\/code><\/pre>\n\n\n\n<p>\u4e8c\u5206\u6cd5\u6c42\u89e3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># @lc app=leetcode.cn id=69 lang=python3\r\n#\r\n# &#91;69] Sqrt(x)\r\n#\r\n#\u4e8c\u5206\u6cd5\r\n# @lc code=start\r\nclass Solution:\r\n    def mySqrt( self,x: int) -> int:\r\n        mid=x\/\/2\r\n        end=x\r\n        start=0\r\n        if x==1:\r\n            return 1\r\n        while end>start+1:\r\n            l=mid**2            \r\n            if  l==x:\r\n                return mid\r\n            if  l&lt;x :\r\n                start=mid\r\n                mid = (mid+end)\/\/2\r\n                continue\r\n            if  l>x:\r\n                end=mid\r\n                mid = (mid)\/\/2\r\n                continue\r\n        return start\r\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-282.png\" alt=\"\" class=\"wp-image-2347\" width=\"410\" height=\"162\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-282.png 638w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-282-300x118.png 300w\" sizes=\"(max-width: 410px) 100vw, 410px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u4f60\u4e00\u4e2a\u975e\u8d1f\u6574\u6570&nbsp;x&nbsp;\uff0c\u8ba1\u7b97\u5e76\u8fd4\u56de&nbsp;x&nbsp;\u7684&nbsp;\u7b97\u672f\u5e73\u65b9\u6839&#038;nb &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/01\/24\/leetcodeday69\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday69 &#8211;\u6c42sqrt<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2345"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=2345"}],"version-history":[{"count":2,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2345\/revisions"}],"predecessor-version":[{"id":2348,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2345\/revisions\/2348"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2345"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}