{"id":129,"date":"2022-05-02T23:01:01","date_gmt":"2022-05-02T15:01:01","guid":{"rendered":"http:\/\/homeyk.com\/?p=129"},"modified":"2024-07-07T19:18:54","modified_gmt":"2024-07-07T11:18:54","slug":"python%e4%b8%8e%e5%9b%9e%e6%96%87%e6%95%b0%e7%9b%b8%e5%85%b3%e7%9a%84%e7%ae%97%e6%b3%95","status":"publish","type":"post","link":"http:\/\/homeyk.com\/?p=129","title":{"rendered":"python | \u56de\u6587\u6570\u76f8\u5173\u7684\u7b97\u6cd5"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def huiwen(x):\n\n    if x==dx(x):\n        return True\n\ndef dx(n):\n    return int(str(n)[::-1])\n\ndef jiafa(n):\n    try:\n        if huiwen(n):\n            return n\n        else:\n            return jiafa(n+dx(n))\n    except RecursionError:\n        print(\"RecursionError\")\n\nn = int(input(\"\u8d77\u59cb\u8f93\u5165\u4e00\u4e2a\u6b63\u6574\u6570\uff1a\"))\nfor i in range(10,n):\n    if jiafa(i):\n        print(f\"\u81ea\u7136\u6570 {i} \uff0c\u53ef\u4ee5\u901a\u8fc7\u6709\u89c4\u5219\u7684\u8fd0\u7b97\uff0c\u83b7\u5f97\u56de\u6587\u6570\uff1a{jiafa(i)}\")\n<\/pre>\n\n\n\n<p>1\u3001\u51fd\u6570\u7684\u5d4c\u5165<\/p>\n\n\n\n<p>2\u3001\u9012\u5f52\u5b9e\u73b0\uff0c\u9012\u5f52\u8fd4\u56de\u7684\u6761\u4ef6\u662f\uff0c\u5c40\u90e8\u53d8\u91cf\u503c\u662f\u56de\u6587\u6570\u3002\u5047\u5982\u4e0d\u662f\uff0c\u5219\u4e0d\u65ad\u6309\u8981\u6c42\u505a\u52a0\u6cd5<\/p>\n\n\n\n<p>3\u3001\u62a5\u9519\u5904\u7406<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u51fd\u6570\u7684\u5d4c\u5165 2\u3001\u9012\u5f52\u5b9e\u73b0\uff0c\u9012\u5f52\u8fd4\u56de\u7684\u6761\u4ef6\u662f\uff0c\u5c40\u90e8\u53d8\u91cf\u503c\u662f\u56de\u6587\u6570\u3002\u5047\u5982\u4e0d\u662f\uff0c\u5219\u4e0d\u65ad\u6309\u8981\u6c42\u505a\u52a0\u6cd5 3\u3001\u62a5\u9519\u5904\u7406<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[15,16],"_links":{"self":[{"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/posts\/129"}],"collection":[{"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/homeyk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=129"}],"version-history":[{"count":1,"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":188,"href":"http:\/\/homeyk.com\/index.php?rest_route=\/wp\/v2\/posts\/129\/revisions\/188"}],"wp:attachment":[{"href":"http:\/\/homeyk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/homeyk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/homeyk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}