{"id":174,"date":"2021-10-14T20:21:36","date_gmt":"2021-10-14T12:21:36","guid":{"rendered":"https:\/\/mzdyl.xyz\/?p=174"},"modified":"2022-03-19T00:26:19","modified_gmt":"2022-03-18T16:26:19","slug":"%e4%bd%9c%e4%b8%9a6-3","status":"publish","type":"post","link":"https:\/\/mzdyl.xyz\/index.php\/2021\/10\/14\/%e4%bd%9c%e4%b8%9a6-3\/","title":{"rendered":"\u4f5c\u4e1a6-3"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1.\u8f93\u51fa\u6574\u6570\u7684\u6240\u6709\u7d20\u56e0\u6570<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include  &lt;bits\/stdc++.h&gt;\nusing namespace std;\n\nbool judge_prime(int a)\n{\n    for(int i = 2;i * i &lt;=a;i++)\n    {\n        if(a%i ==0)\n        {\n            return false;\n        }\n    }\n    return true;\n}\n\nint main()\n{\n    int num;\n    cin &gt;&gt; num;\n\n    for(int i=2;i&lt;=num;i++)\n    {\n        if(num%i==0)\n        {\n            if(judge_prime(i))\n            {\n                cout &lt;&lt; i &lt;&lt; endl;\n            }\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5165\u95e8\u9898\uff0c\u4e0d\u89e3\u91ca<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.\u5bf9\u4e8e\u4efb\u610f\u4e92\u7d20\u7684a\u548cn\uff0c\u8bbef(n)\u4e3a\u5c0f\u4e8e\u7b49\u4e8en\u7684\u6b63\u6574\u6570\u4e2d\u4e0en\u4e92\u7d20\u7684\u6574\u6570\u4e2a\u6570\uff0c\u9a8c\u8bc1:a\u7684f(n)\u6b21\u65b9\u9664\u4ee5n\u7684\u4f59\u6570\u6052\u4e3a1.<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;bits\/stdc++.h&gt;\nusing namespace std;\n\n\/\/emmm,\u4f3c\u4e4e\u6709bug\uff0c\u75282\u548c9\uff0c7\u548c10\u7b49\u80fd\u901a\u8fc7\uff0c\u4f4610\u548c13\u5931\u8d25\n\nbool nn&#091;1008611];\/\/\u5224\u65ad\uff0c\u521d\u59cb\u5168\u4e3afalse\n\nint main()\n{\n    int a ,n;\n    int num = 0;\n    cin &gt;&gt; a &gt;&gt; n;\n\n    for(int i = 2;i &lt;= ceil(n\/2);i++)\n    {\n        if(n%i==0)\/\/n\u7684\u56e0\u6570\u4e00\u5b9a\u4e0d\u7b26\u5408\u4e92\u7d20\n        {\n            nn&#091;i] = true;\n\/\/            cout &lt;&lt; i &lt;&lt; endl;\n            int ii = i;\n            while(ii &lt;= n)\/\/\u5982\u679ci\u4e0d\u7b26\u5408\u6761\u4ef6\uff0c\u90a3\u4e48i\u7684\u500d\u6570\u4e00\u6837\u4e0d\u7b26\u5408\n            {\n                nn&#091;ii] = true;\n                ii +=i;\n\/\/              cout &lt;&lt; ii &lt;&lt; endl;\n            }\n        }\n    }\n\n    for(int x= 1; x&lt;=n;x++)\n    {\n        if(!nn&#091;x]) num ++;\n    }\n\/\/    cout &lt;&lt; \"num \" &lt;&lt;num &lt;&lt; endl;\n    int temp = pow(double(a),double(num));\n\/\/    cout &lt;&lt; temp%n ;\n    if(temp%n==1) cout &lt;&lt; \"\u9a8c\u8bc1\u6210\u7acb\";\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u9898\u6709\u70b9\u610f\u601d<span class='argon-hidden-text argon-hidden-text-blur'>\u5f53\u7136\u4e0d\u662f\u56e0\u4e3a\u4e0d\u77e5\u9053\u4ec0\u4e48\u662f\u4e92\u7d20\u4e86<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u9053\u9898\u601d\u8def\u4e0a\u7684\u96be\u70b9\u5927\u6982\u662f\u5728\u5bfb\u627e\u5c0f\u4e8e\u7b49\u4e8en\u7684\u6b63\u6574\u6570\u4e2d\u4e0en\u4e92\u7d20\u7684\u6574\u6570\u4e2a\u6570\uff0c\u5982\u679c\u5355\u7eaf\u5199\u5faa\u73af\u7684\u8bdd\u6548\u7387\u4f1a\u975e\u5e38\u4f4e\u4e0b\uff0c\u4f46\u5982\u679c\u7528\u5230\u4e00\u70b9\u70b9\u57c3\u5c14\u7b5b\u7684\u7406\u5ff5\uff0c\u5982\u679ci\u4e0d\u7b26\u5408\uff0c\u90a3\u4e48i\u7684\u500d\u6570\u4e00\u6837\u4e0d\u7b26\u5408\uff0c\u5c31\u53ef\u4ee5\u8fc5\u901f\u7f29\u77ed\u8fd0\u884c\u65f6\u95f4\u4e86\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u8f93\u51fa\u6574\u6570\u7684\u6240\u6709\u7d20\u56e0\u6570 \u5165\u95e8\u9898\uff0c\u4e0d\u89e3\u91ca 2.\u5bf9\u4e8e\u4efb\u610f\u4e92\u7d20\u7684a\u548cn\uff0c\u8bbef(n)\u4e3a\u5c0f\u4e8e\u7b49\u4e8en\u7684\u6b63\u6574\u6570\u4e2d\u4e0en\u4e92\u7d20\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-c_plus"],"_links":{"self":[{"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":6,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/posts\/174\/revisions\/517"}],"wp:attachment":[{"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mzdyl.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}