雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 50 下一页

2011年9月26日

摘要: View Code class Point{ protected int x, y; // coordinates of the Point public Point(){ //不带参数的构造方法 x=0; y=0; System.out.println( "Point constructor: "+this.toString() ); } public Point(int a,int b){ //带参数的构造方法 x=a; y=b; System.out.println( "Point con... 阅读全文

posted @ 2011-09-26 14:30 huhuuu 阅读(526) 评论(0) 推荐(0) 编辑

2011年9月19日

摘要: 推出公式;f[0]=1f[1]=1/2*f[0]f[2]=1/4*(f[0]+f[1])f[3]=1/6*(f[0]+f[1]+f[2])f[4]=1/8*(f[0]+f[1]+f[2]+f[3])……JAVA处理View Code import java.util.*;import java.math.*;public class Main { public static void main(String args[]) { Scanner cin=new Scanner(System.in); BigInteger a[],temp,all,fenz... 阅读全文

posted @ 2011-09-19 21:14 huhuuu 阅读(241) 评论(0) 推荐(0) 编辑

摘要: 排列组合的公式推出来比较简单剩下(x/y)%MOD=z 求z比较麻烦先temp=x%MOD再循环i=0->N直到: (temp+i*MOD)%y==0 z=(temp+i*MOD)/yView Code #include<stdio.h>#include<iostream>#include<algorithm>using namespace std;const long long MOD=1000000007;struct data{ int no; char s;}node[109];long long Mon(long long n,long lo 阅读全文

posted @ 2011-09-19 19:46 huhuuu 阅读(241) 评论(0) 推荐(0) 编辑

2011年9月17日

摘要: 类似多对石头的博弈判断哪个先取时,再第i个数与总的S取异或,如果a[i]>=(s^a[i])就是先取它、View Code #include<iostream>#include<stdio.h>#include<algorithm>#include<stdlib.h>#include<string.h>#include<math.h>using namespace std;int a[1000009];int b[1000009];int prim[100009];int padd=0;int pp(int a){ 阅读全文

posted @ 2011-09-17 21:05 huhuuu 阅读(359) 评论(0) 推荐(0) 编辑

2011年9月13日

摘要: 思想是按草的新鲜程度作为第一关键词,前作为第二关键词排序(因为要取钱较少的,所以草鲜嫩排第一)multiset 储存符合第二关键词的 所有第一关键词,取合理且最小的第一关键词累积View Code #include<stdio.h>#include<algorithm>#include<iostream>#include<vector>#include<set>using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EO 阅读全文

posted @ 2011-09-13 22:13 huhuuu 阅读(447) 评论(0) 推荐(0) 编辑

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) 编辑

上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 50 下一页