{"id":208,"date":"2010-04-03T14:41:00","date_gmt":"2010-04-03T06:41:00","guid":{"rendered":"http:\/\/localhost\/?p=208"},"modified":"2010-04-03T14:41:00","modified_gmt":"2010-04-03T06:41:00","slug":"haoi2008_the_whole_point_circle","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=208","title":{"rendered":"[HAOI2008]\u5706\u4e0a\u7684\u6574\u70b9"},"content":{"rendered":"\n<p>[HAOI2008]\u5706\u4e0a\u7684\u6574\u70b9<\/p>\n<p>Time Limit:10000MS&#160; Memory Limit:165536K<br \/>Total Submit:68 Accepted:22 <br \/>Case Time Limit:1000MS<\/p>\n<p><strong>Description <\/strong><\/p>\n<p> \u6c42\u4e00\u4e2a\u7ed9\u5b9a\u7684\u5706(x^2+y^2=r^2)\uff0c\u5728\u5706\u5468\u4e0a\u6709\u591a\u5c11\u4e2a\u70b9\u7684\u5750\u6807\u662f\u6574\u6570\u3002 <\/p>\n<p><strong>Input <\/strong><\/p>\n<p> r  <\/p>\n<p><strong>Output <\/strong><\/p>\n<p> \u6574\u70b9\u4e2a\u6570 <\/p>\n<p><strong>Sample Input <\/strong><\/p>\n<p>4<\/p>\n<p><strong>Sample Output <\/strong><\/p>\n<p>4<\/p>\n<p><strong>Hint <\/strong><\/p>\n<p> n&lt;=2000 000 000 <\/p>\n<p><strong>Source<br \/>\u989d\uff0c\u6211\u53bb\u67e5\u4e86\u67e5\u52fe\u80a1\u6570\u7684\u751f\u6210\u65b9\u6cd5\uff0c\u53d1\u73b0\u662f\u8fd9\u4e2a\u6837\u5b50\u7684\uff0c<br \/>\uff08n\uff0cm\uff09=1,(n^2-m^2)^2+(2mn)^2=(n^2+m^2)^2\u3002\u3002\u540c\u65f6\u4e09\u9879\u5168\u90e8\u4e58\u4e2a\u5565\u5c31\u53ef\u4ee5\u63a8\u5230\u6240\u6709\u6570\uff0c\u6240\u4ee5\u9996\u5148\u679a\u4e3er\/\uff08n,m\uff09\uff0c\u518d\u679a\u4e3en\u548cm\uff0c\u518d\u7528\u4e2aset\u53bb\u91cd\u5c31OK\u4e86\u3002\u3002<br \/>Code\uff1a<br \/><\/strong><\/p>\n<p>#include&lt;iostream&gt;<br \/>#include&lt;set&gt;<br \/>#include&lt;utility&gt;<br \/>using namespace std;<br \/>long long r,n,m;<br \/>typedef pair&lt;int,int&gt; ii;<br \/>set&lt;ii&gt; S;<br \/>int Cal(int d)<br \/>{<br \/>    long long r=::r\/d;<br \/>    n=1,m=1;while(m*m&lt;r)m++;<br \/>    while(n&lt;m)<br \/>    {<br \/>        while(n&lt;m&amp;&amp;n*n+m*m&gt;r)m&#8211;;<br \/>        if(n&gt;=m)break;<br \/>        if(n*n+m*m==r){int a=m*m-n*n,b=2*m*n;S.insert(ii(a*d,b*d));S.insert(ii(b*d,a*d));}<br \/>        n++;<br \/>    }<br \/>}<br \/>int main()<br \/>{<br \/>    cin&gt;&gt;r;int d;<br \/>    for(d=1;d*d&lt;r;d++)if(r%d==0) Cal(r\/d)+Cal(d);<br \/>    if(d*d==r)Cal(d);<br \/>    cout&lt;&lt;S.size()*4+4&lt;&lt;endl;<br \/>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[HAOI2008]\u5706\u4e0a\u7684\u6574\u70b9 Time Limit:10000MS&#160; Memory Limit:165536KTotal Submit:68 Accepted:22 Case Time Limit:1000MS Description \u6c42\u4e00\u4e2a\u7ed9\u5b9a\u7684\u5706(x^2+y^2=r^2)\uff0c\u5728\u5706\u5468\u4e0a\u6709\u591a\u5c11\u4e2a\u70b9\u7684\u5750\u6807\u662f\u6574\u6570\u3002 Input r Output \u6574\u70b9\u4e2a\u6570 Sample Input 4 Sample Output 4 Hint n&lt;=2000 000 000 Source\u989d\uff0c\u6211\u53bb\u67e5\u4e86\u67e5\u52fe\u80a1\u6570\u7684\u751f\u6210\u65b9\u6cd5\uff0c\u53d1\u73b0\u662f\u8fd9\u4e2a\u6837\u5b50\u7684\uff0c\uff08n\uff0cm\uff09=1,(n^2-m^2)^2+(2mn)^2=(n^2+m^2)^2\u3002\u3002\u540c\u65f6\u4e09\u9879\u5168\u90e8\u4e58\u4e2a\u5565\u5c31\u53ef\u4ee5\u63a8\u5230\u6240\u6709\u6570\uff0c\u6240\u4ee5\u9996\u5148\u679a\u4e3er\/\uff08n,m\uff09\uff0c\u518d\u679a\u4e3en\u548cm\uff0c\u518d\u7528\u4e2aset\u53bb\u91cd\u5c31OK\u4e86\u3002\u3002Code\uff1a #include&lt;iostream&gt;#include&lt;set&gt;#include&lt;utility&gt;using namespace std;long long r,n,m;typedef pair&lt;int,int&gt; ii;set&lt;ii&gt; S;int Cal(int d){ long long r=::r\/d; n=1,m=1;while(m*m&lt;r)m++; while(n&lt;m) { while(n&lt;m&amp;&amp;n*n+m*m&gt;r)m&#8211;; if(n&gt;=m)break; if(n*n+m*m==r){int a=m*m-n*n,b=2*m*n;S.insert(ii(a*d,b*d));S.insert(ii(b*d,a*d));} n++; }}int main(){ cin&gt;&gt;r;int d; for(d=1;d*d&lt;r;d++)if(r%d==0) Cal(r\/d)+Cal(d); if(d*d==r)Cal(d); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/208"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=208"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/208\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}