package main; import java.math.BigInteger; public class Main6 { public static void main(String[] args) { int n=2; double sqrt=Math.sqrt(n); String sqrtStr=sqrt+0.0001+""; int pointIndex=sqrtStr.indexOf("."); String left=null; if(pointIndex==-1){ System.out.println("结果为"+sqrtStr); }else{ left=sqrtStr.substring(0,pointIndex+2);// } int leftNum=Integer.parseInt(sqrtStr.substring(0,pointIndex)); int rightNum=Integer.parseInt(sqrtStr.substring(pointIndex+1,pointIndex+2)); String aStr=((n-leftNum*leftNum)*100-(leftNum*20+rightNum)*rightNum)*100+""; String bStr=left.replace(".",""); BigInteger a=new BigInteger(aStr); BigInteger b=new BigInteger(bStr); BigInteger num20=new BigInteger("20"); BigInteger num100=new BigInteger("100"); BigInteger num10=new BigInteger("10"); BigInteger num0=new BigInteger("0"); StringBuilder sb = new StringBuilder(left);//2704 for (int i = 0; i < 700; i++) { int c = 0; try { c = chufa(a,b); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("--bbb--"); } sb.append(c); BigInteger bigC=new BigInteger(c+""); //int d=(b*20+c)*c; BigInteger d=b.multiply(num20).add(bigC).multiply(bigC); if(a.subtract(d).compareTo(num0)<0){ throw new RuntimeException("--ERROR--"+i); } a=a.subtract(d).multiply(num100); b=b.multiply(num10).add(bigC); } System.out.println(sb.toString()); } public static void main2(String[] args) { int a=400; int b=14; for (int i = 0; i < 10; i++) { int c=a/10/2/b; int d=(b*20+c)*c; a=(a-d)*100; b=b*10+c; } } public static void main3(String[] args) { long a=400; long b=14; for (int i = 0; i < 10; i++) { int c=(int)(a/10/2/b); long d=(b*20+c)*c; a=(a-d)*100; b=b*10+c; } } public static int ji(int shiWei,int geWei){ return (shiWei*20+geWei)*geWei; } public static int chufa(BigInteger a,BigInteger b){ if(a.toString().length()<9){ return a.intValue()/20/b.intValue(); }else{ String aa=a.toString(); String bb=b.toString(); String aaa=aa.substring(0,8); String bbb=bb.substring(0,bb.length()-(aa.length()-8)); try { if(Integer.parseInt(aaa)/Integer.parseInt(bbb)/20>10){ throw new RuntimeException("--过大--"+Integer.parseInt(aaa)/Integer.parseInt(bbb)/20); } return Integer.parseInt(aaa)/20/Integer.parseInt(bbb); } catch (NumberFormatException e) { throw new RuntimeException("--aaaa--"); } } } }

javasript LV6
2020年5月22日
luohaipeng LV23
2019年12月3日
低调人 LV38
2019年8月3日
18278380975 LV1
2018年1月30日
sunboris514 LV8
2018年1月4日
865229936 LV6
2017年7月18日
z子盛 LV3
2015年12月1日
836776364 LV2
2015年10月30日
nifeng LV7
2015年10月8日
xysoft LV10
2015年8月19日

javasript LV6
2020年5月22日
luohaipeng LV23
2019年12月3日
dchinaxxx LV2
2019年9月25日
低调人 LV38
2019年8月3日
2451752336 LV2
2019年5月31日
EQ666666 LV12
2018年9月1日
vijayChen LV16
2018年7月4日
sunlsy LV11
2018年6月24日
东北人 LV12
2018年2月27日
18278380975 LV1
2018年1月30日