摘要:POJ2449Remmarguts' Date 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int m,n,s,t,k; 7 #define M 100005 8 #define N 1005 9 #define INF 100000000 10 int dis[N]; 11 struct edge 12 { 13 int v,val,next;//边的终点,边权 14 edge(){} 15 edge(int _v,int _val,int _nex...
阅读全文
摘要:Matrix67:http://www.matrix67.com/blog/archives/115
阅读全文
摘要:题目1167:数组排序数据量小得可怜,完全可以最用朴素的方法。本代码:快速排序,二分查找输出。#include typedef struct node{ int val,idx;}node;node c[10000];int d[10000];void swap(node *a,node *b){ int t; t = a->val; a->val = b->val; b->val = t;}void quick(int left,int right){ int l,r; l = left +1; r = right; if(left >=...
阅读全文
摘要:剑指offer题目1385:重建二叉树print1前序遍历,判断二叉树是否合法,即与输入的二叉树是否匹配,若不匹配输出No;print2后序遍历输出答案; 1 #include 2 int idx[1001],b[1001]; 3 typedef struct node 4 { 5 struct node * lson,*rson; 6 int value; 7 }node,*root; 8 node tree[1001]; 9 root build(int l,int r)10 {11 int i,midx,mval=10000;12 if(l > r)r...
阅读全文