雕刻时光

just do it……nothing impossible
随笔 - 547, 文章 - 0, 评论 - 82, 阅读 - 86万
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

09 2011 档案

摘要:View Code //第七题import java.util.*;class Vehicle{ protected int speed, kind; protected String color; Scanner cin=new Scanner(System.in); public Vehicle(int a){ //不带参数的构造方法 kind=a; System.out.println("构造完成"); } public void setSpeed(int a){ speed=a; } public vo... 阅读全文

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

摘要:View Code import java.util.*;import java.math.*;import java.text.DecimalFormat;public class Main { public static void main(String args[]) { Scanner cin=new Scanner(System.in); double x1,y1,x2,y2; DecimalFormat df = new DecimalFormat("0.00"); while... 阅读全文

posted @ 2011-09-26 15:07 huhuuu 阅读(703) 评论(0) 推荐(0) 编辑

摘要: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 阅读(533) 评论(0) 推荐(0) 编辑

摘要:推出公式;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 阅读(245) 评论(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 阅读(245) 评论(0) 推荐(0) 编辑

摘要:类似多对石头的博弈判断哪个先取时,再第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 阅读(361) 评论(0) 推荐(0) 编辑

摘要:思想是按草的新鲜程度作为第一关键词,前作为第二关键词排序(因为要取钱较少的,所以草鲜嫩排第一)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 阅读(451) 评论(0) 推荐(0) 编辑

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

posted @ 2011-09-08 22:47 huhuuu 阅读(254) 评论(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 阅读(277) 评论(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 阅读(238) 评论(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 阅读(226) 评论(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 阅读(272) 评论(0) 推荐(0) 编辑

摘要:患病的奶牛N只,D种病毒,最多包含K种病毒,求包含最多有几头牛6 3 201 11 21 32 2 12 2 1看到D的范围比较小<=15,用011,表示患了第2,3钟病毒的奶牛a[i]在枚举K种病毒,如110 (用STL里的排列函数枚举)m如m|a[i]==m,说明a[i]包括在m里,add++记录最大值View Code #include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>using namespace std;int a[1009];bool 阅读全文

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

摘要:先将数据插入到一颗二叉树中,再中序遍历该树View Code #include<stdio.h>#include<string.h>#include<iostream>using namespace std;struct data{ int l,m,r;}node[100090];int add,ok=0;;void insert(int c,int root){ if(c>node[root].m)//óò { if(node[root].r==-1) { node[root].r=add; node[... 阅读全文

posted @ 2011-09-02 21:34 huhuuu 阅读(397) 评论(1) 推荐(0) 编辑

摘要:题意:N头牛 公牛与公牛之间最小间隔K头母牛之前用排列组合的方法去思考,数据大,不能解i<=kf[0]=i+1当i头牛是母牛时,没什么限制,f[i]+=f[i-1]当i头是公牛时,之前要有K头奶牛,f[i]+=f[i-k-1]View Code #include<stdio.h>int dp[100009];int main(){ int n,k; while(scanf("%d%d",&n,&k)!=EOF) { int i; for(i=0;i<=n;i++) { if(i<=k) ... 阅读全文

posted @ 2011-09-01 21:15 huhuuu 阅读(173) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示