九度OJ
文章平均质量分 71
choas_up
硕士
展开
-
(题目64)题目1190:大整数排序
Maybe it is easy!#include #include int main(){ char str[101][1001]; char p[1001]="\0"; int i,n,j; while(scanf("%d",&n)!=EOF) { for (i=0;i<n;i++) scanf("%s",str[i]); for (i=0;i<n;i+原创 2015-03-21 19:57:34 · 419 阅读 · 0 评论 -
(题目35)题目1201:二叉排序树
It is some complex.Almost I had forget it.#include typedef struct TNode{ TNode *left; TNode *right; int data;}TNode,*Tree;void PreOrder(Tree T){ if (T) { printf("%d ",T->data); if (T原创 2015-03-19 21:38:47 · 507 阅读 · 0 评论 -
(题目32)题目1078:二叉树遍历
#include #include typedef struct Node{ char e; Node *lchild,*rchild;}Nodue,*BiTree;void PostOrder(BiTree T){ if (T) { if (T->lchild) PostOrder(T->lchild); if (T->rchild) PostOrde原创 2015-03-21 19:23:26 · 428 阅读 · 0 评论 -
(题目33)题目1113:二叉树
#include #define size 10int data[size];int top;int main(){ int n,m,k,e; while(scanf("%d%d",&n,&m)!=EOF&&n!=0) { top=-1; k=0; top++; data[top]=n; while (top!=-1) { e=data原创 2015-03-19 19:26:47 · 423 阅读 · 0 评论 -
(题目30)题目1172:哈夫曼树
#include int sort(int *a,int &n){int tmp,i,j;for (i=0;ifor (j=0;jif (a[j]{tmp=a[j];a[j]=a[j+1];a[j+1]=tmp;}if (n>1){a[n-2]=a[n-2]+a[n-1];a[n-1]=0;}n--;r原创 2015-03-19 16:53:13 · 576 阅读 · 0 评论 -
(题目66)题目1012:畅通工程
刚网上学完并查集,哟西,还挺好用的。主要写一个find()和一个join().void find(int x){int r=x;while (r!=pre[r])r=pre[r];return r;}void find(int x,int y){x=find(x);y=find(y);if (x!=y)pre[y]=x;}ok!用上即可解决问题!#原创 2015-03-21 20:55:56 · 394 阅读 · 0 评论