上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
  2015年7月26日
摘要: //数字三角形 /*#include#define MAX_NUM 100int D[MAX_NUM+10][MAX_NUM+10];int N;int MaxSum(int r,int j){ if(r==N) return D[r][j]; int nSum1=MaxSum(r+1,j);... 阅读全文
posted @ 2015-07-26 00:06 _noname 阅读(95) 评论(0) 推荐(0) 编辑
  2015年7月24日
摘要: //木棍问题#include#includebool concatenate(int,int,int,int);int compare(const void *arg1,const void *arg2){ return *(int *)arg2-*(int *)arg1;}int sticks... 阅读全文
posted @ 2015-07-24 22:42 _noname 阅读(141) 评论(0) 推荐(0) 编辑
  2015年7月23日
摘要: //八皇后问题#include#includeint queenPlaces[92][8];int count=0;int board[8][8];void putQueen(int ithQueen);int main(){ int n,i,j; for(i=0;i<8;i++) { for... 阅读全文
posted @ 2015-07-23 21:31 _noname 阅读(99) 评论(0) 推荐(0) 编辑
摘要: //红与黑#includeint W,H;char z[21][21];int f(int x,int y){ if(x=W||y=H) return 0; if(z[x][y]=='#') return 0; else{ z[x][y]='#'; return 1+f(x-1,y)+f... 阅读全文
posted @ 2015-07-23 20:10 _noname 阅读(101) 评论(0) 推荐(0) 编辑
  2015年7月22日
摘要: //递归-放苹果#includeint count(int x,int y){ if(y==1||x==0) return 1; if(x<y) return count(x,x); return count(x,y-1)+count(x-y,y);}int main(){ int t,m,n,... 阅读全文
posted @ 2015-07-22 23:46 _noname 阅读(106) 评论(0) 推荐(0) 编辑
摘要: //逆波兰表达式#include#includedouble exp(){ char a[10]; scanf("%s",a); switch(a[0]) { case '+':return exp()+exp(); case '-':return exp()-exp(); case '/... 阅读全文
posted @ 2015-07-22 23:05 _noname 阅读(115) 评论(0) 推荐(0) 编辑
摘要: //二叉树#includeint common(int x,int y){ if(x==y) return x; if(x>y) common(x/2,y); else common(x,y/2);}int main(){ int m,n; scanf("%d%d",&m,&n); printf... 阅读全文
posted @ 2015-07-22 21:30 _noname 阅读(90) 评论(0) 推荐(0) 编辑
摘要: //菲波那契数列#includeint f(int a){ if(a==1||a==2) return 1; else return f(a-1)+f(a-2);}int main(){ int n; scanf("%d",&n); for(int i=0;i<=n;i++) { int... 阅读全文
posted @ 2015-07-22 21:26 _noname 阅读(162) 评论(0) 推荐(0) 编辑
摘要: //优化判断条件的例子:讨厌的青蛙#include#includeint r,c,n;struct PLANT{ int x,y;};PLANT plants[5001];PLANT plant;int myCompare(const void *ele1,const void *ele2);i... 阅读全文
posted @ 2015-07-22 20:52 _noname 阅读(143) 评论(0) 推荐(0) 编辑
  2015年7月20日
摘要: //遍历搜索空间的例子:熄灯问题 #include int puzzle[6][8],press[6][8]; bool guess() { int c,r; for(r=1;r1) { press[1][c]=0; ... 阅读全文
posted @ 2015-07-20 22:18 _noname 阅读(171) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页