<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[Irish_Moonshine的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/Irish_Moonshine</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; Irish_Moonshine]]></copyright><item><title><![CDATA[PAT (Advanced Level) 1135 Is It A Red-Black Tree (30分) 【红黑树】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108396535</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108396535</guid><author>Irish_Moonshine</author><pubDate>Fri, 04 Sep 2020 02:13:16 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1135 Is It A Red-Black Tree (30分)


1节点是红色或黑色


2根节点是黑色


3所有NULL节点是黑色


4所有红色节点的子节点是黑色


5从任何一个节点到其每个叶子的所有路径都包含相同数目的黑色节点


因为是递归的对每一个节点的左右子树进行判断，所以理论上左右子树到叶子节点的 路径上的 黑色节点的数量都是一样的。所以不必纠结 Get_Num 中的max。


#include&lt;iostream&gt;
#inclu]]></description><category></category></item><item><title><![CDATA[PTA L3-016 二叉搜索树的结构 (30分) 【BST|测试点细节】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108358937</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108358937</guid><author>Irish_Moonshine</author><pubDate>Wed, 02 Sep 2020 11:27:59 +0800</pubDate><description><![CDATA[L3-016 二叉搜索树的结构 (30分)
Reference: 测试数据细节

注意查询数据不在树内的情况，注意负数情况
谨慎初始化数据

#include&lt;iostream&gt;
#include&lt;cstring&gt; //memset
#include&lt;string&gt;
#include&lt;cstdio&gt; //scanf
#include&lt;string&gt;
#include&lt;utility&gt; // pair
#include&lt;algori]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1088 Rational Arithmetic (20分) 【模拟】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108322655</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108322655</guid><author>Irish_Moonshine</author><pubDate>Mon, 31 Aug 2020 15:52:46 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1088 Rational Arithmetic (20分) 
题意：对两个分数进行加减乘除的操作
分析：一定一定要采用函数化编程，不然会死人的！将分数规格化、分数运算、输出部分进行分块。将负号提出来，统一当做非负数处理。
WA点：

1/-6 需要转换成 -1/6
在进行乘除运算和最后输出的时候，最好将负号提出来，对之后的非负数进行操作
除零
初始运算的时候，最好不要直接转换成假分数，以防增加编码复杂度。
乘法的分母不要搞成最小公倍数

一些测试点：

0/5 0]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1060 Are They Equal (25分) 【注释+简洁编码】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108297322</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108297322</guid><author>Irish_Moonshine</author><pubDate>Sat, 29 Aug 2020 17:51:41 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1060 Are They Equal (25分)
Reference：测试用例
题意：采用科学计数法来判断两个数字是否相等。
分析：

5 001234 1234 数据不规范的情况 YES 0.12340*10^4
5 123 0.1234 有效位数不足的情况 NO 0.12300* 10^3 0.12340*10^0
5 123 0.0012 幂指数为负的情况 NO 0.12300* 10^3 0.12000*10^-2
5 0.0 0.0000  出现0的情况]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1057 Stack (30分)【Multiset||树状数组+二分||线段树分治】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108284110</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108284110</guid><author>Irish_Moonshine</author><pubDate>Fri, 28 Aug 2020 17:59:29 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1057 Stack (30分)
题意：模拟一个栈，实现压入，弹出，查询栈中权值处于中间的元素。
分析：对于老实人来说，肯定是踏踏实实的去模拟栈，然后另开一个数据结构用来保存栈内的元素。那么另一个数据结构理论上应该有排序的功能，而且每次插入和查询的效率应该不超过 log(N)log(N)log(N)

Multiple Set，本着 PAT 特别爱考 STL 的特点。我一开始想到的就是可以自动排序的Set，然后考虑到可能有重复元素，那么就是 Multiset。
理论]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1033 To Fill or Not to Fill (25分)【贪心】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108183544</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108183544</guid><author>Irish_Moonshine</author><pubDate>Sun, 23 Aug 2020 15:35:11 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1033 To Fill or Not to Fill (25分)【贪心】
题意：给你油箱容量 CCC，给你最远想要到达的距离 DDD，给你汽车每升油所能支持的距离 DavgD_{avg}Davg​，给你加油站的数量 NNN。
然后每个加油站，给你距离起点的位置以及油价。
问，你最少可以花费多少美元到达终点。
分析：作为老 DPDPDP 恐慌性选手，起手就是一顿动态规划，然而最后复杂度在 30000∗500∗50030000 * 500* 50030000∗500∗]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1099 Build A Binary Search Tree (30分)【BST】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/108035633</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/108035633</guid><author>Irish_Moonshine</author><pubDate>Sun, 16 Aug 2020 13:54:42 +0800</pubDate><description><![CDATA[1099 Build A Binary Search Tree (30分)

思路：依据二叉搜索树的性质，我只需要知道每个节点左子树的结点总数，以及每个节点右子树的结点总数，我就可以确定当前节点元素的取值。
实现方式：
① 对于节点排序，DFS 遍历整棵树得到每个节点子树的结点总数；
② 根据当前取值区间和左子树节点总数确定当前位置的取值，递归继续赋值；
③ 通过 BFS实现层序遍历。

#include&lt;iostream&gt;
#include&lt;cstring&gt; //memset
#i]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1128 N Queens Puzzle (20分)【化简】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/107850353</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/107850353</guid><author>Irish_Moonshine</author><pubDate>Thu, 06 Aug 2020 21:52:11 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1128 N Queens Puzzle (20分)

首先声明，这个题直接双循环暴力就可以过，但是我觉得这样就没什么意思了。复杂度已经超过两亿  200∗1000∗1000200*1000*1000200∗1000∗1000 ，O(N2∗K)O({N}^{2}*K)O(N2∗K) 可能是浙大的OJ比较强劲。
本算法复杂度 O(NK)O(NK)O(NK)
首先解决的问题就是保证每行与每列的元素唯一，给出的数据就已经是行唯一了，对于列开一个标记数组解决一下。
对于列上]]></description><category></category></item><item><title><![CDATA[PAT (Advanced Level) 1123 Is It a Complete AVL Tree (30分)【AVL】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/107799419</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/107799419</guid><author>Irish_Moonshine</author><pubDate>Tue, 04 Aug 2020 21:06:46 +0800</pubDate><description><![CDATA[PAT (Advanced Level) 1123 Is It a Complete AVL Tree (30分)

构建一颗完全二叉树（相关代码有注释）
通过BFS实现层次遍历（亦可与获取完全二叉树合并，在一个DFS中实现）
通过DFS这棵树获取每个结点在完全二叉树的下标 indexindexindex，检查该完全二叉树是否有空位，即可做出判断
在使用指针进行操作的时候，一定特别注意指针为空的情况！！！

#include&lt;iostream&gt;
#include&lt;cstring&gt;
#]]></description><category></category></item><item><title><![CDATA[简单决策树调用&可视化【Python】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/96159876</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/96159876</guid><author>Irish_Moonshine</author><pubDate>Tue, 16 Jul 2019 17:53:27 +0800</pubDate><description><![CDATA[决策树部分理论支撑
1* 通过选取一定的特征来降低数据的不确定性（熵）
2* 建议寻找多分类问题的最优特征的最优候选值。把多分类问题转换成多几层递归的二分类问题，防止数据对特征值的控制敏感。
3* 停止条件

取得了最够好的分类结果
递归到了预定的最深深度
叶子节点的纯度
分裂次数达到极限
最大特征数
. . .

4* 相关公式

entropy(D)=−∑i=1nPilog2Pientropy...]]></description><category></category></item><item><title><![CDATA[Matlab 线性规划&非线性规划&零点问题实例]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95664525</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95664525</guid><author>Irish_Moonshine</author><pubDate>Fri, 12 Jul 2019 21:41:08 +0800</pubDate><description><![CDATA[可编辑代码在EOF（Hhhhh）



1

%编写fun函数文件
function f = fun(x)
f = exp(x(1))*(4*x(1)^2 + 2*x(2)^2 +4*x(1)*x(2) + 2*x(2) + 1);
end

%编写约束条件nonlinearcondition函数文件
function [c,ceq]= nonlinearcondition(x)
c(1) = ...]]></description><category></category></item><item><title><![CDATA[Matlab 问题实例【循环、积分、微分、绘图、最值、极值】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95540752</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95540752</guid><author>Irish_Moonshine</author><pubDate>Fri, 12 Jul 2019 00:21:49 +0800</pubDate><description><![CDATA[可复制代码在末尾




1

1466015503701
Temp = 1;
i = 0;
Ans = 0;
while(i&lt;=20) 
    Ans = Ans + Temp;
    Temp = Temp * 4;
    i = i + 1;
end
fprintf('%d\n',Ans);


2

x1 = 0.0000;  x2 = 0.4839;
Min = 3.871...]]></description><category></category></item><item><title><![CDATA[POJ 3281 Dining【拆点+SAP网络流】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95383887</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95383887</guid><author>Irish_Moonshine</author><pubDate>Wed, 10 Jul 2019 21:43:25 +0800</pubDate><description><![CDATA[POJ 3281 Dining

这里选择使用的是SAP网络流里的Dinic

题意：有n头牛，f个食物，d个饮料。每头牛都有一些自己喜欢的食物和饮料，当且仅当这头牛获得了一个自己喜欢的饮料和一个自己喜欢的食物，他才会开心。求，最多可能有多少牛会开心。每种食物和饮料只有一个。
一种解题思路：使用网络流，试图构建满流数量为答案的网络。
一种建图思路：超级源点S指向所有食物的边的权值为1，被喜欢的食物...]]></description><category></category></item><item><title><![CDATA[HDU 1532 Drainage Ditches【HLPP网络流（最高标号预流推进）】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95369777</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95369777</guid><author>Irish_Moonshine</author><pubDate>Wed, 10 Jul 2019 19:32:48 +0800</pubDate><description><![CDATA[HDU 1532 Drainage Ditches

最大流裸题（同POJ 1273）
代码做了我所能理解的，比较详尽的注释。
参考教程：最大流算法-最高标号预流推进(HLPP)【PS：这大哥为了缩行，太可怕了QAQ】

#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;cstdio&gt;
#include&lt;algor...]]></description><category></category></item><item><title><![CDATA[NOIP 2002 过河卒【记忆化搜索】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95249886</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95249886</guid><author>Irish_Moonshine</author><pubDate>Tue, 09 Jul 2019 22:45:21 +0800</pubDate><description><![CDATA[NOIP 2002 过河卒
我大概是思维僵化了，我一直就在那里琢磨怎么怎么DP，然后。。。就忘记了记忆化搜索= =，太呆了QAQ
#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;cstdio&gt;
#include&lt;algorithm&gt;
#include&lt;string&gt;
#include&lt;ma...]]></description><category></category></item><item><title><![CDATA[NOIP 2002 产生数【建图+DFS+数乘大数】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95249345</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95249345</guid><author>Irish_Moonshine</author><pubDate>Tue, 09 Jul 2019 22:42:57 +0800</pubDate><description><![CDATA[NOIP 2002 产生数
一种解决思路：可以考虑每一个数字可以最终变换成多少个不同的数字，数字关系可以考虑建成有向图，然后开始深搜广搜都可。

注意答案会超过longlonglong longlonglong  intintint

#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;cstdio&gt;
#include&l...]]></description><category></category></item><item><title><![CDATA[NOIP 2002 选数【DFS】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95249066</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95249066</guid><author>Irish_Moonshine</author><pubDate>Tue, 09 Jul 2019 22:37:49 +0800</pubDate><description><![CDATA[NOIP 2002 选数
暴力枚举所有可以发生的情况即可。
试图素数筛，结果发现自己是个弱智= =，并不能优雅起来。
#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;cstdio&gt;
#include&lt;algorithm&gt;
#include&lt;string&gt;
#include&lt;map&gt;
...]]></description><category></category></item><item><title><![CDATA[洛谷 P1035 级数求和【二分||枚举】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95248681</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95248681</guid><author>Irish_Moonshine</author><pubDate>Tue, 09 Jul 2019 22:34:46 +0800</pubDate><description><![CDATA[洛谷 P1035 级数求和
Emmm，这个题吧，明明可以枚举。
但是我非要二分，试图优雅，结果内存超限了一发。。。
#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;cstdio&gt;
#include&lt;algorithm&gt;
#include&lt;string&gt;
#include&lt;map&gt;
#...]]></description><category></category></item><item><title><![CDATA[BZOJ 1305 dance跳舞【二分+Dinic网络流】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95042952</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95042952</guid><author>Irish_Moonshine</author><pubDate>Mon, 08 Jul 2019 09:21:35 +0800</pubDate><description><![CDATA[BZOJ 1305  dance跳舞
分析：Dinic没什么好说的，问题就是出在建图之上。
一种建图思路：

将所有的男生、女生，作为一个节点并且每个节点引出并指向两个新的节点分别表示’不喜欢’和‘’喜欢’两个节点。建立超级源点S 和 超级汇点 T，通过 S 指向每个男生的主节点，每个女生的主节点指向T，来表示流量。
二分答案，该答案等于每一条从S指向男生主节点的边权，同时等于每个女生主节点指向T...]]></description><category></category></item><item><title><![CDATA[BZOJ 1001 狼抓兔子【Dinic网络流】]]></title><link>https://blog.csdn.net/Irish_Moonshine/article/details/95022776</link><guid>https://blog.csdn.net/Irish_Moonshine/article/details/95022776</guid><author>Irish_Moonshine</author><pubDate>Sun, 07 Jul 2019 19:59:27 +0800</pubDate><description><![CDATA[BZOJ 1001 狼抓兔子
一道非常裸的网络流问题，但是需要一定的优化。
这个题的正解应该是SPFA+对偶图，但网络流也Ok。

当前弧优化（注释了，没用到，比较弱的优化）
多路增广（相比于朴素Dinic而言，是一个非常强的优化）
炸点（将无法增广的点，深度标记为不存在，比较强的优化）

#include&lt;iostream&gt;
#include&lt;cstring&gt;
#incl...]]></description><category></category></item></channel></rss>