{"id":102,"date":"2010-02-12T22:33:00","date_gmt":"2010-02-12T14:33:00","guid":{"rendered":"http:\/\/localhost\/?p=102"},"modified":"2010-02-12T22:33:00","modified_gmt":"2010-02-12T14:33:00","slug":"sgu_111","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=102","title":{"rendered":"SGU 111"},"content":{"rendered":"<p> \u5c31\u662f\u7ed9\u4f60\u4e00\u4e2a1000\u4f4d\u4ee5\u4e0b\u7684\u6570\u3002\u3002\u6c42\u4ed6\u7684\u5e73\u65b9\u6839\uff08round down\uff09\u3002\u3002<br \/>\u6211\u7531\u4e8e\u662fjava\u7684\u3002\u3002\u4f46\u662fjava\u4e2dbiginteger\u6ca1\u6709sqrt\u7684\u529f\u80fd\u3002\u3002\u6211\u53ea\u597d\u7528\u4e8c\u5206\u67e5\u627e\u4e86\u3002\u3002<br \/>\u5982\u679c\u4f4d\u6570\u662fn\u7684\u8bdd\u3002\u3002\u4e8c\u5206\u662fn\u7684\u3002\u3002\u4e58\u6cd5\u662fnlogn\u7684\u3002\u3002\u6240\u4ee5\u603b\u5171\u5c31\u662fn^2logn\u7684\u3002<br \/>\u5176\u5b9e\u662f\u670910n\u7684\u597d\u529e\u6cd5\u7684\u3002\u3002<br \/>\u4e0d\u8fc7\u6211\u592a\u61d2\u4e86\u3002\u3002<br \/>Code\uff1a<br \/>import java.util.*;<br \/>import java.math.*;<br \/>public class Main<br \/>{<br \/> static Scanner in=new Scanner(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">System<\/a>.in);<br \/> public static void main(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Ajava.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">String<\/a> args[])<br \/> {<br \/> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a> l,r,m,x,tmp;<br \/>  l=<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.valueOf(0);x=in.nextBigInteger();<br \/>  r=x.abs().add(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.ONE);<br \/>  while(l.add(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.ONE).compareTo(r)==-1)<br \/>  {<br \/>   m=l.add(r).divide(<a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ABigInteger+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">BigInteger<\/a>.valueOf(2));<br \/>   if(m.multiply(m).compareTo(x)!=1)<br \/>    l=m;<br \/>   else<br \/>    r=m;<br \/>  }<br \/> <a href=\"http:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3ASystem+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky\">System<\/a>.out.println(l);<br \/> }<br \/>} <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c31\u662f\u7ed9\u4f60\u4e00\u4e2a1000\u4f4d\u4ee5\u4e0b\u7684\u6570\u3002\u3002\u6c42\u4ed6\u7684\u5e73\u65b9\u6839\uff08round down\uff09\u3002\u3002\u6211\u7531\u4e8e\u662fjava\u7684\u3002\u3002\u4f46\u662fjava\u4e2dbiginteger\u6ca1\u6709sqrt\u7684\u529f\u80fd\u3002\u3002\u6211\u53ea\u597d\u7528\u4e8c\u5206\u67e5\u627e\u4e86\u3002\u3002\u5982\u679c\u4f4d\u6570\u662fn\u7684\u8bdd\u3002\u3002\u4e8c\u5206\u662fn\u7684\u3002\u3002\u4e58\u6cd5\u662fnlogn\u7684\u3002\u3002\u6240\u4ee5\u603b\u5171\u5c31\u662fn^2logn\u7684\u3002\u5176\u5b9e\u662f\u670910n\u7684\u597d\u529e\u6cd5\u7684\u3002\u3002\u4e0d\u8fc7\u6211\u592a\u61d2\u4e86\u3002\u3002Code\uff1aimport java.util.*;import java.math.*;public class Main{ static Scanner in=new Scanner(System.in); public static void main(String args[]) { BigInteger l,r,m,x,tmp; l=BigInteger.valueOf(0);x=in.nextBigInteger(); r=x.abs().add(BigInteger.ONE); while(l.add(BigInteger.ONE).compareTo(r)==-1) { m=l.add(r).divide(BigInteger.valueOf(2)); if(m.multiply(m).compareTo(x)!=1) l=m; else r=m; } System.out.println(l); }}<\/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\/102"}],"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=102"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}