gzpk

2010年6月24日

有序表的折半查找

摘要: 非递归实现代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include<stdio.h>intsearch(intnum[],intn,intkey){intlow=0;inthigh=n-1;intmid=0;while(low&... 阅读全文

posted @ 2010-06-24 18:15 gzpk 阅读(336) 评论(0) 推荐(0)

1.2将帅问题

摘要: 题目:棋盘中只有将帅,列出他们的所有合法位置,要求只用一个变量 。代码1:[代码]intmain(){chari=81;while(i--){if(i/9%3==i%9%3)continue;printf("i=%d,A=%d,B=%d\n",i,i/9+1,i%9+1);}return0;}代码2:代码Code highlighting produced by Actipro CodeHighl... 阅读全文

posted @ 2010-06-24 16:35 gzpk 阅读(148) 评论(0) 推荐(0)

导航