<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[GYH0730的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/GYH0730</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; GYH0730]]></copyright><item><title><![CDATA[判断合法出栈序列]]></title><link>https://blog.csdn.net/GYH0730/article/details/93647243</link><guid>https://blog.csdn.net/GYH0730/article/details/93647243</guid><author>GYH0730</author><pubDate>Tue, 25 Jun 2019 19:44:32 +0800</pubDate><description><![CDATA[PIPI现有a-z 26个小球模拟出入栈操作，小球按照a~z的顺序压入栈，在栈顶的元素可以随时被取出，在游戏开始前给出任意26个字母的一些排列，问是否能够由出栈顺序得到这个排列。

输入

输入包含多组测试用例。
每组测试用例包含26个字母组成的一个序列。

输出

若出栈顺序合法，输出"yes",否则输出"no".

样例输入


abcdefghijklmnopqrstuvwxyz
za...]]></description><category></category></item><item><title><![CDATA[FZU - 2203 单纵大法好（贪心+二分）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90488180</link><guid>https://blog.csdn.net/GYH0730/article/details/90488180</guid><author>GYH0730</author><pubDate>Thu, 23 May 2019 21:17:05 +0800</pubDate><description><![CDATA[两年前的坑现在补上，经典的贪心+二分


#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
const int maxn = 200005;
int N,K,A,M;
int pos[maxn];
bool vis[maxn];
bool judge(int m)
{
    int i,cnt,len;
    memset( vis,fals...]]></description><category></category></item><item><title><![CDATA[HDU - 3345 War Chess（优先队列+BFS）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90488150</link><guid>https://blog.csdn.net/GYH0730/article/details/90488150</guid><author>GYH0730</author><pubDate>Thu, 23 May 2019 21:15:22 +0800</pubDate><description><![CDATA[两年前的坑现在补上，广搜，把点加入优先队列里


#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;queue&gt;
using namespace std;
int n,m,total;
char mp[108][108],ans[108][108];
int vis[108][108];
int to[4][2] ...]]></description><category></category></item><item><title><![CDATA[POJ - 1330 Nearest Common Ancestors（倍增LCA）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90473509</link><guid>https://blog.csdn.net/GYH0730/article/details/90473509</guid><author>GYH0730</author><pubDate>Thu, 23 May 2019 08:24:32 +0800</pubDate><description><![CDATA[裸的求LCA，用的倍增，就是为了记个模板，似懂非懂，以后有时间就弄懂这些算法(大概率不会了。。。。。。)


#include &lt;queue&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

using namespace std;
const int MAXN = 10010;
const int DEG = 20;

stru...]]></description><category></category></item><item><title><![CDATA[POJ - 3171 Cleaning Shifts（DP+线段树优化）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90413561</link><guid>https://blog.csdn.net/GYH0730/article/details/90413561</guid><author>GYH0730</author><pubDate>Tue, 21 May 2019 19:44:25 +0800</pubDate><description><![CDATA[题意：头牛，每头牛在到时间段干活并需要数量的钱，想要在到时间段的每一时刻都有牛在干活，最少需要多少钱？

思路：首先把不在到时间段干活的牛给去除，在把剩下的牛按照从小到大排序，表示从到都有牛干活的最下花费，挨个遍历每个时间段，有：

                       

其中找最小值部分可以用线段树来优化


#include &lt...]]></description><category></category></item><item><title><![CDATA[POJ - 3734 Blocks（矩阵快速幂）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90369271</link><guid>https://blog.csdn.net/GYH0730/article/details/90369271</guid><author>GYH0730</author><pubDate>Mon, 20 May 2019 09:41:19 +0800</pubDate><description><![CDATA[题意：个球，有红黄蓝绿4种颜色，要求红球和绿球有偶数个，有多少种排列方式？

思路：

：红球与绿球都为偶数的个数

：红球与绿球恰有一个为偶数的个数

：红球与绿球都为奇数的个数








#include &lt;stdio.h&gt;
#include &lt;vector&gt;
using namespace std;
const int mod = 10007;
typedef ...]]></description><category></category></item><item><title><![CDATA[POJ - 3254 Corn Fields (状压DP)]]></title><link>https://blog.csdn.net/GYH0730/article/details/90346024</link><guid>https://blog.csdn.net/GYH0730/article/details/90346024</guid><author>GYH0730</author><pubDate>Sun, 19 May 2019 19:18:02 +0800</pubDate><description><![CDATA[题意：个格子，有些可以放牛，有些不可以放牛，放的牛不能相邻，问共有多少种放牛的方案？

思路：状压，表示第行状态为前行的方案数目，外层循环一行一行的枚举，内层嵌套枚举第行的状态和第行的状态，最后答案为


#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
const int mod = 100000000;
int dp[15][1 &lt;&l...]]></description><category></category></item><item><title><![CDATA[POJ - 2441 Arrange the Bulls （状压DP）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90345477</link><guid>https://blog.csdn.net/GYH0730/article/details/90345477</guid><author>GYH0730</author><pubDate>Sun, 19 May 2019 18:23:31 +0800</pubDate><description><![CDATA[题意：头牛，个牛棚，每个牛棚只能有一头牛，每头牛都只能在自己喜欢的牛棚里，给每头牛安排位置，总共有多少种安排方案？

思路：每个牛棚可以放牛也可以不放牛，个牛棚，故可以用状压，表示状态下，给前i头牛分配牛棚的方案数



 ( &amp; ，)

当前状态只与上一状态有关，可以用滚动数组来节省空间


#include &lt;stdio.h&gt;
#include &lt;string....]]></description><category></category></item><item><title><![CDATA[POJ - 3411 Paid Roads（Dijkstra+状压）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90344802</link><guid>https://blog.csdn.net/GYH0730/article/details/90344802</guid><author>GYH0730</author><pubDate>Sun, 19 May 2019 17:23:09 +0800</pubDate><description><![CDATA[题意：个城市，条单向路，每一条路从到，如果之前已经经过了城市，花费可以为也可以为，没有经过城市，花费为，求从城市到的最小花费

思路：求最短路，多加一维表示已经走过的点的集合。


#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;queue&gt;
#include &lt;algorithm&gt;
const in...]]></description><category></category></item><item><title><![CDATA[POJ - 1795 DNA Laboratory（状压DP）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90344515</link><guid>https://blog.csdn.net/GYH0730/article/details/90344515</guid><author>GYH0730</author><pubDate>Sun, 19 May 2019 17:12:30 +0800</pubDate><description><![CDATA[题意：个只包含字母的字符串，求出包含这n个字符串的最短字符串

思路：

1.首先除去相同的和被包含在其它字符串里的字符串

2.求出，把第i个字符串放到第j个字符串前花费

3.状压，，第个字符串在最前面，状态为情况下的最小花费

边界：

递推方程：

这样就求出了最短长度下的第一个字符串s

4.从开始贪心的求出最优解


#include &lt;stdio.h&gt;
#include ...]]></description><category></category></item><item><title><![CDATA[POJ - 2836 Rectangular Covering（状压DP+几何）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90343149</link><guid>https://blog.csdn.net/GYH0730/article/details/90343149</guid><author>GYH0730</author><pubDate>Sun, 19 May 2019 16:53:16 +0800</pubDate><description><![CDATA[题意：平面上有n个点，要求用矩形去覆盖所有的点，每一个矩形至少覆盖两个点，每一个点可以被重复覆盖，求最小的能覆盖所有点的矩形的面积。

思路：枚举两个点，一个矩形覆盖这两个点的最小面积是以这两个点为对角线，所以我们可以得到个矩形，求出这些矩形的面积和覆盖的点，接下来就是状压了：

                             ...]]></description><category></category></item><item><title><![CDATA[POJ - 2886 Who Gets the Most Candies? （线段树+反素数）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90311371</link><guid>https://blog.csdn.net/GYH0730/article/details/90311371</guid><author>GYH0730</author><pubDate>Sat, 18 May 2019 09:41:58 +0800</pubDate><description><![CDATA[题意：有个小盆友围成一圈，从第个小朋友开始，选中谁谁退圈，每个小朋友都有一个数，这个数为正数表明下一个选中的小朋友即为这个小朋友左边第个小朋友，为负数表明下一个选中的小朋友为这个小朋友右边第个小朋友。每个小朋友退圈即可获得的因子数的糖果数，为这个小朋友是第几个退圈的，输出这个获得最多的糖果的小朋友的名字和她获得的糖果数。

思路：个小朋友，获得最多的糖果的那个人的编号为中有最多因子数的那个数，所以...]]></description><category></category></item><item><title><![CDATA[POJ-2991 Crane（线段树）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90272665</link><guid>https://blog.csdn.net/GYH0730/article/details/90272665</guid><author>GYH0730</author><pubDate>Thu, 16 May 2019 21:40:47 +0800</pubDate><description><![CDATA[题意：给出n条线段，开始时n条线段一词首尾相连，与地面垂直，c次操作，每次操作给出,，让线段和之间德角度变为度，并输出第n条线段的前端坐标。

思路：线段树，区间存储的线段的向量坐标，父亲节点的向量坐标就等于儿子节点的向量坐标相加，在存储一个角度变量，类似于懒惰标记的作用，将一条线段逆时针旋转v度后的坐标为





顺时针：






#include &lt;math.h&gt;
#incl...]]></description><category></category></item><item><title><![CDATA[POJ - 3279 Fliptile(反转)]]></title><link>https://blog.csdn.net/GYH0730/article/details/90236031</link><guid>https://blog.csdn.net/GYH0730/article/details/90236031</guid><author>GYH0730</author><pubDate>Wed, 15 May 2019 14:40:24 +0800</pubDate><description><![CDATA[题意：一个01矩阵，每翻转一个格子，这个格子的上下左右的格子都会被翻转，要把整个矩阵的格子都翻转为0，求需要翻转的最小次数，最小次数的解为多个时，输出字典序最小的一组。解不存在输出IMPOSSIBLE。

思路：如果暴力搜索的话有种翻转的方法，超时。如果第一行是否翻转已经确定，那么第二行是否翻转也确定了，同理除了最后一行其余所有的格子是否翻转都已确定了，如果最后一行有1的话就说明不存在可行解。所以...]]></description><category></category></item><item><title><![CDATA[POJ - 3320 Jessica's Reading Problem（尺取法）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90235712</link><guid>https://blog.csdn.net/GYH0730/article/details/90235712</guid><author>GYH0730</author><pubDate>Wed, 15 May 2019 14:20:28 +0800</pubDate><description><![CDATA[题意：求最少的连续读的页数能读到所有的知识点

思路：尺取法，把所有的知识点的编号放到set里求出知识点的个数，在尺取过程中用map记录当前以学知识点的个数。


#include &lt;map&gt;
#include &lt;set&gt;
#include &lt;stdio.h&gt;
#include &lt;algorithm&gt;
#define maxn 1000005
usi...]]></description><category></category></item><item><title><![CDATA[组合数学基础]]></title><link>https://blog.csdn.net/GYH0730/article/details/90182294</link><guid>https://blog.csdn.net/GYH0730/article/details/90182294</guid><author>GYH0730</author><pubDate>Tue, 14 May 2019 08:17:17 +0800</pubDate><description><![CDATA[n元素集合的循环r排列的数目是:

                                    

特别的，n个元素的循环排列的数目是

帕斯卡公式：

                                   

多重集合的排...]]></description><category></category></item><item><title><![CDATA[数论基础]]></title><link>https://blog.csdn.net/GYH0730/article/details/90182292</link><guid>https://blog.csdn.net/GYH0730/article/details/90182292</guid><author>GYH0730</author><pubDate>Mon, 13 May 2019 21:57:02 +0800</pubDate><description><![CDATA[欧几里德算法

即求两个数的最大公因子


int GCD(int a,int b)
{
    if(b == 0) return a;
    else return GCD(b,a % b);
}

扩展欧几里德算法

它可以用来求解（a，b，c为整数）的方程的一组整数解，事实上，只有时，此方程才有整数解。具体实现




ll exgcd(ll a,ll b,ll&amp; x,ll&am...]]></description><category></category></item><item><title><![CDATA[UVA - 11582 Colossal Fibonacci Numbers!（取模）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90114959</link><guid>https://blog.csdn.net/GYH0730/article/details/90114959</guid><author>GYH0730</author><pubDate>Sat, 11 May 2019 21:06:35 +0800</pubDate><description><![CDATA[题意：输入两个非负整数a，b（0 &lt;= a,b &lt; 2^64）和 n（1&lt;= n &lt; 1000)，输出f（a^b) % n，f为斐波那契数列。

思路：所有计算都是对n取模的，不妨设F(i) = f(i) % n，当f(i - 1)，f(i)出现重复时，整个序列就开始重复。余数最多有n种，所以最多n*n项就会出现重复，所以先计算出周期，再用快速幂求出a^b%M即可。


#...]]></description><category></category></item><item><title><![CDATA[POJ - 1061 青蛙的约会 （扩展欧几里得找最小正整数解）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90051633</link><guid>https://blog.csdn.net/GYH0730/article/details/90051633</guid><author>GYH0730</author><pubDate>Fri, 10 May 2019 09:29:46 +0800</pubDate><description><![CDATA[题意：两只青蛙在圆圈上追赶，圆圈我们可以看作是一条首尾相接的数轴。设青蛙A的出发点坐标是x，青蛙B的出发点坐标是y。青蛙A一次能跳m米，青蛙B一次能跳n米，两只青蛙跳一次所花费的时间相同。总长L米。现在要你求出它们跳了几次以后才会碰面。

思路：设跳了t次以后才会碰面，则有(x + tm) % L = (y + tn) % L，即 (x + tm) - (y + tn) = PL，整理得：(n -...]]></description><category></category></item><item><title><![CDATA[POJ - 3292 Semi-prime H-numbers (埃氏筛思想）]]></title><link>https://blog.csdn.net/GYH0730/article/details/90048680</link><guid>https://blog.csdn.net/GYH0730/article/details/90048680</guid><author>GYH0730</author><pubDate>Thu, 09 May 2019 21:46:40 +0800</pubDate><description><![CDATA[题意：H数为4n + 1这样的数，H数的乘法是封闭的，H素数只能表示为1和它本身的乘积，除了H素数，其余的都是H合数，半素数是恰好能表示为两个H素数的乘积，给出一个数X，输出这个数以及小于等于这个数的半素数的个数

思路：埃氏筛思想


#include &lt;stdio.h&gt;
const int maxn = 1000005;
int a[maxn],cnt[maxn];
void in...]]></description><category></category></item></channel></rss>