自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

转载 2014-10-20

//把in_order[L1...R1]和post_order[L2...R2]建成一棵二叉树,返回树根 int build(int L1,int R1, int L2, int R2){     if(L1 > R1)         return 0;//空树     int root = post_order[R2];     int p = L1;     while(in_o

2014-10-20 20:20:29 292

转载 图的遍历

//图的深度优先遍历(邻接矩阵) void graph::depehfirstsearch(const int startpoint,int visited[], void visit(char item)){     int neighborpoint;     visit(getvalue(startpoint));//访问节点的startpoint     visited[start

2014-10-18 17:00:11 395

转载 二叉树代码

//递归法遍历二叉树 void btree ::visit(node * searchp){ coutdata; } void btree::preorder(node *searchp) { if(searchp != NULL){ visit(searchp); preorder(searchp->lchild); preorder(searchp->rchild);

2014-10-17 21:29:52 286

转载 2014-10-16

/*P143悲剧文本  *采用链表,每输入一个字符就把它存起来,设输入的字符串为S[1-N],  *则可以用next【i】表示当前显示屏幕中右边的字符编号*/ #include #include using namespace std; const int maxn = 10005; int last, cur, next[maxn]; char s[maxn]; int

2014-10-16 21:33:45 320

转载 2014-10-16

/*信息解码P83*/ #include #include int code[8][1 int readchar(){     for(;;){         int ch = getchar();         if(ch != '\n' && ch != '\r'){             return ch;         }     } }//跨行读取字符

2014-10-15 22:58:02 379

转载 几道题目

#include #include using namespace std; const int maxn = 1000; int main(){     int n, q, x, a[maxn],kase = 0;     while(scanf("%d%d",&n,&q) == 2 && n){//n为大理石的个数,q为所要查询的个数         printf

2014-10-14 23:09:58 295

转载 The dole queue

/*  *救济金发放(the dole queue P82) */ #include #define max 25 int n, k, m, a[max]; int go(int p,int d,int t){     while(t--){         do{             p = (p+d+n-1) %n + 1;         }    

2014-10-12 21:21:37 301

转载 刽子手游戏P79

#include #include #define maxn 100 int left,chance;//还需要猜left个位置,错chance之后就会输 char kstring[maxn],gstring[maxn]; int win,lose; void guess(char ch){     int bad = 1;     int i;     for(

2014-10-12 15:47:43 313

转载 环状序列

/*环状序列  *求最小表示--字典序最小(一般对于两个字符串,从第一个字符开始比较,当某一个位置的字符不同时,该位置字符较小的串,字典序较小。  *如果其中一个字符串已经没有更多的字符,但另一个字符还没结束,则较短的字符串字典序较小)  */  /*解法:用变量ans表示到目前为止,字典序最小串在输入串中的起始位置,然后不断更新ans*/  #include  #include  

2014-10-12 13:21:55 689

转载 生成元

http://codepad.org/cTao3Kvg /*生成元  *如果X加上X的各个数字之和得到Y,就说X是Y的生成元。给出N,N在1到100000之间,求最小生成元  *提高效率,可以查表进行计算*/  #include  #include  #define maxn 100005  int ans[maxn];//较大的数在函数外部定义  int

2014-10-12 12:41:07 659

转载 回文词和镜像串的判断

/*判断是否为回文串和镜像串(P42)*/ #include #include #include const char* rev = "A 3 HIL JM 0  2TUWXY51SE Z 8";//镜像字符表 const char* msg[] = {"not a palindrome", "a regular palindrome","a mirrored string", "a m

2014-10-12 12:12:29 826

转载 linux学习

ubuntu的root用户默认是禁止的,需要手动打开才行 事实上ubuntu下的所有操作都用不到root用户,由于sudo的合理使用,避免了root用户下误操作而产生的毁灭性问题 root账号启用方法(其实我个人认为这没有多大必要): 执行下面的操作: 1.先解除root锁定,为root用户设置密码 打开终端输入:sudo passwd Password: <--- 输入你当前用户的密

2014-09-27 20:14:21 226

原创 java学习

创建对象时,声明对象和实例化对象两步缺一不可。

2014-07-04 22:26:21 341

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除