- 博客(17)
- 资源 (2)
- 收藏
- 关注
原创 PAT 1107 Social Clusters
挺简单的题目吧,但是并查集的一个函数写挫了。写demo跑了一下也没啥问题啊,以后还是老实一点吧。 #include <cstdio> #include <algorithm> #include <iostream> #include <vector> using namespace std; const int maxn = 1010; int ...
2018-08-28 16:49:30 249
原创 解决Windows Server 2012 R2 下_findnext()异常
今天在服务器上部署算法的时候,其中的两个遍历文件夹的函数报了错误。具体定位在_findnext()这个函数这里,0xC0000005错误 。原函数如下: void getFiles(string path, vector&lt;string&gt;&amp; files) { //file handle long hFile = 0; //file info ...
2018-08-23 17:26:21 676 2
原创 PAT 1064.Complete Binary Search Tree
这道题目就很不错啦。 完全二叉排序树按层序存放在从1开始的数组中,左右儿子节点的索引分别为(根节点索引假设为root)root*2和root*2+1。而二叉排序树的中序遍历是递增的。我们现在把输入序列排序,就可以得到中序遍历的序列了。于是我们开始遍历这棵左右儿子节点的索引分别为(根节点索引假设为root)root*2和root*2+1的空树,与以往一边遍历一边打印不同的是,我们是一边遍历,一边给...
2018-08-17 17:44:06 272
原创 PAT 1043.Is It a Binary Search Tree
掌握二叉排序树的一些常规操作就可以了。我的思路就是:按照输入的先序遍历建立二叉查找树,然后对这棵二叉查找树进行先序遍历以及镜像先序遍历。两个之中有一个对上,输出”YES”和后序遍历或者镜像后序遍历的序列。两个都对不上就输出”NO”呗。 所以不用怕镜像,也不用管镜像。 #include <cstdio> #include <queue> #include <al...
2018-08-16 19:25:31 192
原创 BST 基操
struct node{ typename data; node* lchild; node* rchild; }; node* newNode(int v){ node* Node = new node; Node->data = v; Node->lchild = Node->rchild = NULL; r...
2018-08-16 12:06:31 211
原创 PAT 1053.Path of Equal Weight
你怎么那么熟练啊? #include <cstdio> #include <queue> #include <algorithm> #include <iostream> #include <time.h> #include <vector> using namespace std; const int maxn = ...
2018-08-15 16:35:47 176
原创 PAT 1004 Counting Leaves
没说明说的吧。如果想用bfs的话。在pop的时候更新深度比较好。 #include <cstdio> #include <queue> #include <algorithm> #include <iostream> #include <time.h> #include <vector> using namespace st...
2018-08-14 18:38:48 222
原创 code backup
// FaceSampling_1.cpp: 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <opencv2/opencv.hpp> #include <iostream> #include <io.h> #include <fstream> #include <locale.h> #in...
2018-08-11 17:01:20 405
原创 PAT 1106 Lowest Price in Supply Chain
差不多先生 我的差不多是天生 #include <cstdio> #include <queue> #include <algorithm> using namespace std; const int maxn = 100011; struct node{ double data; vector<int> child; }...
2018-08-06 18:54:34 150
原创 PAT 1094 The Largest Generation
水题。 #include <cstdio> #include <queue> #include <algorithm> #include <math.h> #include <vector> using namespace std; const int maxn = 111; int n,m; vector<int> ...
2018-08-06 17:32:28 148
原创 PAT 1079 Total Sales of Supply Chain
一开始用的是bfs,觉得bfs应该也是没有任何问题的。虽然题目给的样例过了,但是测试样例一部分过不了,而且代码量也比深搜要冗长。所以后来就改成dfs。既不需要每次pop以后修改节点的深度,逻辑也更清楚(其实差不多清楚。。) #include <cstdio> #include <queue> #include <algorithm> #include &l...
2018-08-06 16:00:49 172
原创 PAT 1090 Highest Price in Supply Chain
基础题。递归需要注意两点千万别忘了。不然在写递归代码的时候就会特别没有章法。很乱。 递归边界。即递归的重点。 递归式。即递推式。 #include <cstdio> #include <queue> #include <algorithm> using namespace std; const int maxn = 100011; struct no...
2018-08-03 20:30:10 144
原创 PAT 1102 Invert a Binary Tree
Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. ——————————-Max Howell @twitter 哈哈哈这句话实在...
2018-08-03 11:30:19 164
原创 PAT 1086 Tree Traversals Again
后序遍历打印原来这么简单。。 太久了都忘记掉了。。 #include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include <map> #include <math.h> #include <string.h>
2018-08-02 15:36:46 139
原创 PAT 1020 Tree Traversals
传入递归的参数应该是什么,递归返回的参数应该是什么。 这两个问题在写递归的时候都是十分重要的。 直接影响了你代码逻辑的清晰度和可读性。 同时也反映了你对这道题目的理解。 #include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include ...
2018-08-02 11:32:14 165
原创 PAT 1091.Acute Stroke
一道比较简单的30分的题目,经典的bfs,skr。 #include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include <map> #include <math.h> #include <string.h>
2018-08-01 17:08:35 225 1
原创 PAT 1103. Integer Factorization
范围内的p次方的数打表 vector直接等号赋值 dfs的思路,可以重复选,以打表内的数组每一组选或者不选为dfs的分支 注意剪枝 #include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include <map> #include...
2018-08-01 10:44:31 197
Computer Vision:Models,Learning and Inference
2018-04-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人