{"id":19,"date":"2025-11-09T20:35:46","date_gmt":"2025-11-09T12:35:46","guid":{"rendered":"https:\/\/tblog.zeabur.app\/?p=19"},"modified":"2025-11-09T20:35:46","modified_gmt":"2025-11-09T12:35:46","slug":"%e9%a2%98%e8%a7%a3-luogu-p11003","status":"publish","type":"post","link":"https:\/\/tblog.zeabur.app\/?p=19","title":{"rendered":"\u9898\u89e3 Luogu P11003"},"content":{"rendered":"\n<p>\u8fd9\u9898\u4e00\u770b\u6570\u636e\u8303\u56f4 $n\\leq 10^{18}$ \u5c31\u77e5\u9053\u66b4\u529b\u4f1a\u8d85\u65f6\uff0c\u6240\u4ee5\u8fd9\u9898\u4e00\u5b9a\u6709\u89c4\u5f8b\u53ef\u5faa\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u627e\u89c4\u5f8b\uff1a\uff08\u4ee5\u4e0b 1 \u4ee3\u8868 true\uff0c0 \u4ee3\u8868 false\uff09<\/h2>\n\n\n\n<p>\u9898\u610f\uff1a<\/p>\n\n\n\n<p>\u5f53\u4e00\u4e2a\u4eba\u4e3a $1$ \u65f6\uff0c\u540e\u9762\u4e24\u4e2a\u4eba\u53ea\u80fd\u4e3a $01$ \u6216 $10$\u3002<\/p>\n\n\n\n<p>\u5f53\u4e00\u4e2a\u4eba\u4e3a $0$ \u65f6\uff0c\u540e\u9762\u4e24\u4e2a\u4eba\u53ea\u80fd\u4e3a $00$ \u6216 $11$\u200b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7b2c\u4e00\u4f4d\u4e3a 1<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u63a5 01<\/h4>\n\n\n\n<p>\u5b57\u7b26\u4e32\u53d8\u4e3a $101$\uff0c\u7b2c\u4e8c\u4f4d\u4e3a $0$\uff0c\u4e14 $0$ \u4e4b\u540e\u4e00\u5b9a\u4e3a $00$ \u6216\u8005 $11$\uff0c\u4e14\u7b2c\u4e09\u4f4d\u4e3a $1$\uff0c\u6240\u4ee5\u7b2c\u56db\u4f4d\u4e00\u5b9a\u4e3a $1$\uff0c\u5b57\u7b26\u4e32\u53d8 \u4e3a\uff1a$1011$\u3002<\/p>\n\n\n\n<p>\u4f9d\u6b64\u89c4\u5f8b\u5411\u4e0b\u63a8\uff0c\u4f9d\u6b21\u4e3a $10110$\uff0c$101101$\uff0c$1011011$\uff0c$10110110$\u3002<\/p>\n\n\n\n<p>\u53ef\u89c1\u4e00\u76f4\u51fa\u73b0 $101$\uff0c\u5373\u5f53 $n$ \u6574\u9664 $3$ \u65f6\uff0c\u6bcf\u4e09\u4f4d\u4e2d\u90fd\u51fa\u73b0\u4e00\u6b21\u5047\uff0c\u603b\u5171\u6709 $\\frac{n}{3}$ \u4e2a\u5047\uff0c\u7b54\u6848\u52a0\u4e0a $\\frac{n}{3}$\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u63a5 10<\/h4>\n\n\n\n<p>\u4f9d\u6b21\u63a8\u7406\uff0c\u4e3a $110$\uff0c$1101$\uff0c$11011$\uff0c$110110$\uff0c$1101101$\uff0c$11011011$\u200b\u3002<\/p>\n\n\n\n<p>\u53ef\u89c1\u4e00\u76f4\u51fa\u73b0 $110$\uff0c\u5373\u5f53 $n$ \u6574\u9664 $3$ \u65f6\uff0c\u6bcf\u4e09\u4f4d\u4e2d\u90fd\u51fa\u73b0\u4e00\u6b21\u5047\uff0c\u603b\u5171\u6709 $\\frac{n}{3}$ \u4e2a\u5047\uff0c\u7b54\u6848\u518d\u52a0\u4e0a $\\frac{n}{3}$\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7b2c\u4e00\u4f4d\u4e3a 0<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">\u63a5 11<\/h4>\n\n\n\n<p>\u4e5f\u4e0d\u96be\u5f97\u5230 $011$\uff0c$0110$\uff0c$01101$\uff0c$011011$\uff0c$0110110$\uff0c$01101101$\u200b\u3002<\/p>\n\n\n\n<p>\u53ef\u89c1\u4e00\u76f4\u51fa\u73b0 $011$\uff0c\u5373\u5f53 $n$ \u6574\u9664 $3$ \u65f6\uff0c\u6bcf\u4e09\u4f4d\u4e2d\u90fd\u51fa\u73b0\u4e00\u6b21\u5047\uff0c\u603b\u5171\u6709 $\\frac{n}{3}$ \u4e2a\u5047\uff0c\u7b54\u6848\u518d\u52a0\u4e0a $\\frac{n}{3}$\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u63a5 00<\/h4>\n\n\n\n<p>\u5206\u522b\u5f97\u5230 $000$\uff0c$0000$\uff0c$00000$\uff0c$000000$\uff0c$0000000$\uff0c$00000000$\u3002<\/p>\n\n\n\n<p>\u65e0\u8bba $n$ \u4e3a\u51e0\uff0c\u90fd\u51fa\u73b0 $n$ \u6b21\u5047\uff0c\u7b54\u6848\u52a0\u4e0a $n$\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u603b\u7ed3<\/h3>\n\n\n\n<p>\u5f53 $n$ \u6574\u9664 $3$ \u65f6\uff0c\u7b54\u6848\u4e3a<br>$$<br>\\frac{n}{3}+\\frac{n}{3}+\\frac{n}{3}+n=2\\times n<br>$$<br>\u5f53 $n$ \u4e0d\u6574\u9664 $3$ \u65f6\uff0c\u7b54\u6848\u5c31\u4e3a $n$\uff0c\u5373 $n$ \u4e2a\u5047\u76f8\u63a5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801\uff1a<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">c++<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;bits\/stdc++.h&gt;\n#define int long long\nusing namespace std;\ninline void solve()\n{\n    int n;\n    cin&gt;&gt;n;\n    cout&lt;&lt;(!(n%3)?(n*2):n)&lt;&lt;endl;\n}\nsigned main() \n{\n    int t;\n    cin&gt;&gt;t;\n    while(t--)solve();\n    return 0;\n}<\/code><\/pre>\n\n\n\n<p>\u4ecb\u4e8e\u662f Python \u7ec4\u7684\u9898\u76ee\uff0c\u4e5f\u653e\u4e00\u4e0b Python \u4ee3\u7801<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Python<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>t=int(input())\nfor _ in range(t):\n    n=int(input())\n    if n%3==0:\n        print(n*2)\n    else:\n        print(n)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u9898\u4e00\u770b\u6570\u636e\u8303\u56f4 $n\\leq 10^{18}$ \u5c31\u77e5\u9053\u66b4\u529b\u4f1a\u8d85\u65f6\uff0c\u6240\u4ee5\u8fd9\u9898\u4e00\u5b9a\u6709\u89c4\u5f8b\u53ef\u5faa\u3002 \u627e\u89c4\u5f8b\uff1a\uff08\u4ee5\u4e0b  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-oi","tag-oi"],"featured_image_src":null,"author_info":{"display_name":"CaelumRadish_c","author_link":"https:\/\/tblog.zeabur.app\/?author=1"},"_links":{"self":[{"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":1,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tblog.zeabur.app\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}