随笔分类 -  PTA程序设计

摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int N = 1111; vector<int> G[N];//邻接表 bool 阅读全文
posted @ 2020-02-11 10:28 JasonPeng1 阅读(180) 评论(0) 推荐(0)
摘要:堆的详细创建过程:参考:https://www.jianshu.com/p/21bef3fc3030 明白堆的详细创建过程的前提是要理解Shift Down。 但是这明显不符合最大堆的定义,所以我们需要让该完全二叉树转换成最大堆!怎么转换成一个最大堆呢? 最大堆有一个特点就是其各个子树都是一个最大堆 阅读全文
posted @ 2020-02-02 18:49 JasonPeng1 阅读(237) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int N = 1010; int father[N]; int isRoot[N] 阅读全文
posted @ 2020-01-31 23:09 JasonPeng1 阅读(117) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 110; struct node{ int v,height; 阅读全文
posted @ 2020-01-30 20:51 JasonPeng1 阅读(158) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 1010; int temp[maxn],initial[ma 阅读全文
posted @ 2020-01-29 13:08 JasonPeng1 阅读(176) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; struct node{ int data; node *left; node *right; 阅读全文
posted @ 2020-01-29 12:27 JasonPeng1 阅读(139) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int MAXN = 110; struct Node{ int weight; v 阅读全文
posted @ 2020-01-27 23:12 JasonPeng1 阅读(114) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; struct node{ //bool lea 阅读全文
posted @ 2020-01-27 22:40 JasonPeng1 阅读(214) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> child[maxn] 阅读全文
posted @ 2020-01-27 21:34 JasonPeng1 阅读(116) 评论(0) 推荐(0)
摘要:法1:BFS #include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> temp 阅读全文
posted @ 2020-01-26 21:32 JasonPeng1 阅读(302) 评论(0) 推荐(1)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; struct node{ double dat 阅读全文
posted @ 2020-01-26 20:32 JasonPeng1 阅读(127) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 100010; vector<int> child[maxn] 阅读全文
posted @ 2020-01-26 20:03 JasonPeng1 阅读(167) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 110; struct node{ int lchild,rc 阅读全文
posted @ 2020-01-24 16:48 JasonPeng1 阅读(154) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; const int maxn = 50; struct node{ int data; node 阅读全文
posted @ 2020-01-23 23:15 JasonPeng1 阅读(116) 评论(0) 推荐(0)
摘要:若直接DFS递归求解,会栈溢出 #include <cstdio> #include <cstring> #include <queue> #include <algorithm> using namespace std; const int maxn=50; struct node{ int da 阅读全文
posted @ 2020-01-21 21:58 JasonPeng1 阅读(271) 评论(0) 推荐(0)
摘要:#pragma warning(disable:4996) #include <stdio.h> #include <stdlib.h> #include <queue> using namespace std; struct node{ int x, y, z; }p; int m, n, l, 阅读全文
posted @ 2020-01-19 22:44 JasonPeng1 阅读(103) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; //maxFacSum 记录最大底数之和 int n,k,p,maxFaceSum = -1; vector<int> fac,ans,t 阅读全文
posted @ 2020-01-19 18:08 JasonPeng1 阅读(130) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 100005; const int TABLE = 1000010; struct Node{//定义静 阅读全文
posted @ 2020-01-19 17:11 JasonPeng1 阅读(129) 评论(0) 推荐(0)
摘要:自己写的,少了异常处理。 #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 100010; struct Node{//定义静态链表 int data; 阅读全文
posted @ 2020-01-19 00:21 JasonPeng1 阅读(113) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 100010; struct Node{//定义静态链表 char data; int next; bo 阅读全文
posted @ 2020-01-18 20:11 JasonPeng1