{"id":78,"date":"2011-08-11T13:22:17","date_gmt":"2011-08-11T05:22:17","guid":{"rendered":"http:\/\/wangkaixuan.tech\/?p=78"},"modified":"2020-06-03T13:23:13","modified_gmt":"2020-06-03T05:23:13","slug":"poj-2262-goldbachs-conjecture","status":"publish","type":"post","link":"http:\/\/www.wangkaixuan.tech\/?p=78","title":{"rendered":"POJ 2262 Goldbach&#8217;s Conjecture"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/*\n\u4e0d\u7528\u6253\u8868\u76f4\u63a5\u7b97\u5c31\u884c\n\u4f46\u662f\u4e0d\u8981\u7528cin cout\n\u7528C\u8bed\u8a00\u7684\u8f93\u5165\u8f93\u51fa\n\u6bd4C++\u7684\u8981\u5feb\u5f97\u591a \n*\/\n#define LOCAL\n#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cmath>\n#include&lt;cstring>\n#include&lt;cstdlib>\n#include&lt;iomanip>\n#include&lt;string>\n#include&lt;algorithm>\n#include&lt;ctime>\n#include&lt;stack>\n#include&lt;queue>\n#include&lt;vector>\n#define N 1000\nusing namespace std;\nint prime(int n)\n{\n       int t,i;\n       if(n==2)\n         return 1;\n       t=(int)sqrt((double)n);\n       for(i=2;i&lt;=t+1;i++)\n       {if(n%i==0) return 0;}\n       return 1;    \n}\nint main()\n{\n#ifdef LOCAL\n       freopen(\"input.txt\",\"r\",stdin);\n       freopen(\"output.txt\",\"w\",stdout);\n#endif\n  \n    int i,n;\n    while(scanf(\"%d\",&amp;n),n)\n    {\n              for(i=3;i&lt;n;i+=2)\n              {\n                    if(prime(i)&amp;&amp;prime(n-i))\n                    {\n                             printf(\"%d = %d + %d\\n\",n,i,n-i);\n                             goto end;\n                             break;                    \n                    }                         \n              } \n              puts(\"Goldbach's conjecture is wrong.\"); \n              end:;              \n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-06-01-acm"],"_links":{"self":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":0,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.wangkaixuan.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}