{"id":914,"date":"2012-06-23T23:09:59","date_gmt":"2012-06-23T15:09:59","guid":{"rendered":"http:\/\/www.hsyyf.me\/?p=914"},"modified":"2012-06-23T23:19:22","modified_gmt":"2012-06-23T15:19:22","slug":"project-euler-9","status":"publish","type":"post","link":"https:\/\/www.hsyyf.me\/?p=914","title":{"rendered":"Project Euler 9"},"content":{"rendered":"<p>\u4e3a\u4e86\u953b\u70bc\u7f16\u7a0b\u7684\u5b9e\u9645\u80fd\u529b\uff0c\u4ece\u73b0\u5728\u5f00\u59cb\u7740\u624b\u5f00\u59cb\u8ba1\u7b97\u6b27\u62c9\u9879\u76ee\u3002<\/p>\n<p>\u4eca\u5929\u662f\u7b2c9\u9898\uff0c\u76f8\u5bf9\u7b80\u5355\u7684\u4e00\u9053\u9898\u3002<\/p>\n<div>\n<p>A Pythagorean triplet is a set of three natural numbers, <var>a<\/var>&lt; <var>b&lt;<\/var> <var>c<\/var>, for which,<\/p>\n<div style=\"text-align: center;\"><var>a<\/var><sup>2<\/sup> + <var>b<\/var><sup>2<\/sup> = <var>c<\/var><sup>2<\/sup><\/div>\n<p>For example, 3<sup>2<\/sup> + 4<sup>2<\/sup> = 9 + 16 = 25 = 5<sup>2<\/sup>.<\/p>\n<p>There exists exactly one Pythagorean triplet for which <var>a<\/var> + <var>b<\/var> + <var>c<\/var> = 1000.<br \/>\nFind the product <var>abc<\/var>.<\/p>\n<p>\u5bfb\u627e\u4e00\u7ec4\u52fe\u80a1\u6570\uff0c\u4f7f\u5f97\u4e09\u4e2a\u6570\u7684\u548c\u4e3a1000\uff0c\u6c42\u8fd9\u7ec4\u6570\u7684\u4e58\u79ef\u3002\u7a0b\u5e8f\u8f83\u4e3a\u7b80\u5355\uff0c\u7528C\u8bed\u8a00\u8fdb\u884c\u5b9e\u73b0\uff1a<br \/>\n<code lang=\"C\">#include<stdio.h><br \/>\n int main(void)<br \/>\n {<br \/>\n\t int a,b,c;<br \/>\n\t for(a=3;a<332;a++)\n\t {\n\t\t for(b=a+1;b<997;b++)\n\t\t {\n\t\t\t c=1000-a-b;\n\t\t\t if(c<=0&#038;&#038;c<b)\n\t\t\t {\n\t\t\t\t break;\n\t\t\t }\n\t\t\t if(a*a+b*b==c*c)\n\t\t\t {\n\t\t\t\t printf(\"%d,%d,%d\\n\",a,b,c);\n\t\t\t\t printf(\"%d\",a*b*c);\n\t\t\t }\n\t\t }\n\t }\n\t return 0;\n }<\/code><br \/>\n&nbsp;<br \/>\n\u7ed3\u679c\uff1aa=200,b=375,c=425,\u4e58\u79ef\u4e3a31875000\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4e86\u953b\u70bc\u7f16\u7a0b\u7684\u5b9e\u9645\u80fd\u529b\uff0c\u4ece\u73b0\u5728\u5f00\u59cb\u7740\u624b\u5f00\u59cb\u8ba1\u7b97\u6b27\u62c9\u9879\u76ee\u3002 \u4eca\u5929\u662f\u7b2c9\u9898\uff0c\u76f8\u5bf9\u7b80\u5355\u7684\u4e00\u9053\u9898\u3002 A Pythago [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[16],"tags":[66,127],"class_list":["post-914","post","type-post","status-publish","format-standard","hentry","category-16","tag-c","tag-project-euler"],"_links":{"self":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=914"}],"version-history":[{"count":0,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/914\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}