2011年5月2日

二分查找题

摘要: hdu 2141 hdu 1025 hdu 2899 hdu 2034 hdu 1551 hdu 2199 阅读全文

posted @ 2011-05-02 23:48 more think, more gains 阅读(145) 评论(0) 推荐(0) 编辑

ACM学习计划 来自c++奋斗乐园

摘要: OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094) 初期: 一.基本算法: (1)枚举. (poj1 OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,po... 阅读全文

posted @ 2011-05-02 21:46 more think, more gains 阅读(442) 评论(0) 推荐(0) 编辑

前m大的数

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>int dp[11000],A[5100];int main( ){ int N,M,i,j,k,max; while(scanf("%d%d",&N,&M)!=EOF) { k=0;max=0; memset(dp,0,sizeof(dp)); for(i=1;i<=N;i++) scanf... 阅读全文

posted @ 2011-05-02 15:44 more think, more gains 阅读(262) 评论(0) 推荐(0) 编辑

敌兵布阵

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>int N,c[51100];int lowbit(int x){ return x&-x;}void add(int x,int i){ while(i<=N) { c[i]+=x; i+=lowbit(i);}}int sum(int i){ int sum=0; while(i) { s... 阅读全文

posted @ 2011-05-02 15:03 more think, more gains 阅读(230) 评论(0) 推荐(0) 编辑

An easy problem

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int fun(char c,int x){ int f[26]; int i; for(i=0;i<26;i++) f[i]=i+1; if(c>='A'&&c<='Z') return f[c-'A']+x; else return -f[c-'a']+x;}int main( ){ in... 阅读全文

posted @ 2011-05-02 14:17 more think, more gains 阅读(159) 评论(0) 推荐(0) 编辑

最小公倍数 2 递归

摘要: #include<stdio.h>int gcd(int n,int m){ return m?gcd(m,n%m):n;}int main( ){ int a,b; while(scanf("%d%d",&a,&b)!=EOF) printf("%d\n",a*b/gcd(a,b)); return 0;} 阅读全文

posted @ 2011-05-02 13:44 more think, more gains 阅读(167) 评论(0) 推荐(0) 编辑

最小公倍数 //辗转相除法

摘要: #include<stdio.h>#include<string.h>void swap(int &x,int &y){ int temp; if(x<y) { temp=x; x=y; y=temp; }}int fun(int x,int y){ int a,b,r; a=x,b=y; swap(x,y); while(r) { r=x%y; x=y; y=r; } return a*b/x;}int main( ){ int N,M; while(scanf("%d%d",&N,&M)!=EOF) prin 阅读全文

posted @ 2011-05-02 13:26 more think, more gains 阅读(277) 评论(0) 推荐(0) 编辑

download..仔细分析各种情况

摘要: #include<stdio.h>#include<string.h>/*N总的 num 为相等个数t1为ch1中的1个数t2为ch2中的1个数 可能性分析:1.ch2全为1,steps 1 t2==N2.ch1与ch2相等 steps 0 num==N4.反转为的步数 steps 1 num=0 3.单选steps N-nums4.全选后steps 1+N-t25.反选后steps 1+num6... 阅读全文

posted @ 2011-05-02 11:59 more think, more gains 阅读(153) 评论(0) 推荐(0) 编辑

easy problem

摘要: 数学题,求因子。。(i+1)(j+1)=N+1 #include<stdio.h>#include<math.h>int main(){ int N,i,n,j; __int64 M; scanf("%d",&N); while(N--) { n=0; scanf("%I64d",&M); M++; j=sqrt(M*1.0); for(i=2;i<=j;i++) if(M%i==0) n++; ... 阅读全文

posted @ 2011-05-02 09:53 more think, more gains 阅读(208) 评论(0) 推荐(0) 编辑

导航