雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年9月8日

摘要: 注意大数a,b是否相等比较不能 if(a==b)//虽然这样写语法没问题要用 .compareTo()的方法View Code 阅读全文

posted @ 2011-09-08 22:47 huhuuu 阅读(253) 评论(0) 推荐(0) 编辑

摘要: 小数相加 注意1.1+1.9=4结果简单表示.stripTrailingZeros().toPlainString()//去掉大数后面多余的0,并用简单法表示View Code import java.util.*;import java.math.*;public class Main { public static void main(String args[]){ Scanner scan=new Scanner(System.in); while(scan.hasNextBigDecimal()){ BigDecimal a,b; ... 阅读全文

posted @ 2011-09-08 21:38 huhuuu 阅读(275) 评论(0) 推荐(0) 编辑

摘要: BigInteger 没有sqrt的功能,所以用二分做注意:BigInteger l,r,mid,x=scan.nextBigInteger();//有时会出现PE所以:BigInteger l,r,mid,x; x =scan.nextBigInteger();View Code 阅读全文

posted @ 2011-09-08 21:00 huhuuu 阅读(233) 评论(0) 推荐(0) 编辑

摘要: 计算a^b-b^aView Code import java.util.*;import java.math.*;public class Solution { public static void main(String args[]){ Scanner scan=new Scanner(System.in); int a=scan.nextInt(); int b=scan.nextInt(); BigInteger x =BigInteger.valueOf(a); ... 阅读全文

posted @ 2011-09-08 18:49 huhuuu 阅读(222) 评论(0) 推荐(0) 编辑

摘要: toPlainString()按一般数学表达式表示toString()按科学型表示replaceAll("^0", "") 如果整数里有零,替换掉View Code import java.util.*;import java.math.*;public class Main { public static void main(String args[]){ Scanner scan=new Scanner(System.in); while(scan.hasNext()) { BigDecimal a=scan.nextB... 阅读全文

posted @ 2011-09-08 09:40 huhuuu 阅读(261) 评论(0) 推荐(0) 编辑