﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-Lemon的空间</title><link>http://www.cppblog.com/jiyuan/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:08:33 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:08:33 GMT</pubDate><ttl>60</ttl><item><title>Producers and Consumers</title><link>http://www.cppblog.com/jiyuan/archive/2009/08/03/91987.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Sun, 02 Aug 2009 17:26:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/08/03/91987.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/91987.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/08/03/91987.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/91987.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/91987.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Here are my OS practices.<br>If certain mistakes are found, please mail to me "jiyuan0914@gmail.com"&nbsp;&nbsp;<a href='http://www.cppblog.com/jiyuan/archive/2009/08/03/91987.html'>阅读全文</a><img src ="http://www.cppblog.com/jiyuan/aggbug/91987.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-08-03 01:26 <a href="http://www.cppblog.com/jiyuan/archive/2009/08/03/91987.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Producer and Consumer</title><link>http://www.cppblog.com/jiyuan/archive/2009/08/02/91933.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Sat, 01 Aug 2009 17:11:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/08/02/91933.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/91933.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/08/02/91933.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/91933.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/91933.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Here are my OS practices.<br>If certain mistakes are found, please mail to me "jiyuan0914@gmail.com"&nbsp;&nbsp;<a href='http://www.cppblog.com/jiyuan/archive/2009/08/02/91933.html'>阅读全文</a><img src ="http://www.cppblog.com/jiyuan/aggbug/91933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-08-02 01:11 <a href="http://www.cppblog.com/jiyuan/archive/2009/08/02/91933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The Dinning Philosophers Problem</title><link>http://www.cppblog.com/jiyuan/archive/2009/08/01/91874.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Sat, 01 Aug 2009 03:45:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/08/01/91874.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/91874.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/08/01/91874.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/91874.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/91874.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Here are my OS practices.<br>If certain mistakes are found, please mail to me "jiyuan0914@gmail.com"&nbsp;&nbsp;<a href='http://www.cppblog.com/jiyuan/archive/2009/08/01/91874.html'>阅读全文</a><img src ="http://www.cppblog.com/jiyuan/aggbug/91874.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-08-01 11:45 <a href="http://www.cppblog.com/jiyuan/archive/2009/08/01/91874.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>动态规划专练(不断练习更新中)</title><link>http://www.cppblog.com/jiyuan/archive/2009/04/15/79956.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Tue, 14 Apr 2009 16:57:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/04/15/79956.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/79956.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/04/15/79956.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/79956.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/79956.html</trackback:ping><description><![CDATA[<p>1.Tourist <a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=2964">http://acm.pku.edu.cn/JudgeOnline/problem?id=2964</a>&nbsp;做过一道类似的<a href="http://acm.hdu.edu.cn/showproblem.php?pid=2686">http://acm.hdu.edu.cn/showproblem.php?pid=2686</a>规模小,可以n^4(dp[x1][y1][x2][y2])解决,本题要一个n^3的状态方程.仔细观察n^4的方程,可以发现有很多冗余状态.dp[step][x1][x2], y1 = step - x1, y2 = step - x2.<br>2.Polygon <a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=1179">http://acm.pku.edu.cn/JudgeOnline/problem?id=1179</a>&nbsp;有一个细节要特别注意，两个很小的负数相乘变成一个很大的正数。枚举第一条要消去的边，再dp[form][to][2]，最后一维0记录最小值，1记录最大值，记忆化搜索一下。<br>3.Milking Time <a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=3616">http://acm.pku.edu.cn/JudgeOnline/problem?id=3616</a>&nbsp;一维dp，按开始时间排序，特殊处理第一段（不用休息），注意时间段，比如r = 2时, [1, 2]和[4, 5]不冲突。<br>4.Euro Efficiency <a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=1252">http://acm.pku.edu.cn/JudgeOnline/problem?id=1252</a>&nbsp;无穷背包，或最短路搜索。有个细节要注意：一个数可以由超过100的数减另一个数得到。<br>5.Washing Clothes <a href="http://acm.pku.edu.cn/JudgeOnline/problem?id=3211">http://acm.pku.edu.cn/JudgeOnline/problem?id=3211</a>&nbsp;简单的01背包，每件衣服的时间小于1000，总时间不超过100000，背包分配男生的任务，剩下就是女生的了。</p>
<img src ="http://www.cppblog.com/jiyuan/aggbug/79956.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-04-15 00:57 <a href="http://www.cppblog.com/jiyuan/archive/2009/04/15/79956.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>pell方程解法--学习笔记</title><link>http://www.cppblog.com/jiyuan/archive/2009/04/01/78543.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Wed, 01 Apr 2009 03:31:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/04/01/78543.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/78543.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/04/01/78543.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/78543.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/78543.html</trackback:ping><description><![CDATA[<p style="FONT-FAMILY: courier new">形如 X2&nbsp;-&nbsp;D * Y2&nbsp;= A&nbsp;称为pell方程。其实不是pell发现的。<br>只要D不是平方数，方程就有解，解有无穷多个。</p>
<p style="FONT-FAMILY: courier new">因式分解方程 ： (X + sqrt(D) * Y) * (X - sqrt(D) * Y) = A</p>
<p style="FONT-FAMILY: courier new">先找到一个最小的解(a, b)</p>
<p style="FONT-FAMILY: courier new">再构造其余的解</p>
<p style="FONT-FAMILY: courier new"><o:p>(X + sqrt(D) * Y)^2 * (X - sqrt(D) * Y)^2 = A<br></o:p></p>
<p style="FONT-FAMILY: courier new"><o:p>(X + sqrt(D) * Y)^3 * (X - sqrt(D) * Y)^3 = A&nbsp;<br></o:p></p>
<p style="FONT-FAMILY: courier new"><o:p>(X + sqrt(D) * Y)^4 * (X - sqrt(D) * Y)^4 = A&nbsp;</o:p></p>
<p style="FONT-FAMILY: courier new">&#8230;&#8230;</p>
<img src ="http://www.cppblog.com/jiyuan/aggbug/78543.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-04-01 11:31 <a href="http://www.cppblog.com/jiyuan/archive/2009/04/01/78543.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ 1813 Escape from Tetris</title><link>http://www.cppblog.com/jiyuan/archive/2009/03/13/76486.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Fri, 13 Mar 2009 09:55:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/03/13/76486.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/76486.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/03/13/76486.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/76486.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/76486.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1813IDA* g(x,y) = depth, h(x, y) = 从x,y到出口的最小距离,先BFS求每一格到出口的最短距离,剪枝的效果蛮不错的大家如果能把我的数据跑进200MS应该没问题了#include&nbsp;&lt;stdio.h&gt;#include&nbsp;&lt;stdlib.h&gt;...&nbsp;&nbsp;<a href='http://www.cppblog.com/jiyuan/archive/2009/03/13/76486.html'>阅读全文</a><img src ="http://www.cppblog.com/jiyuan/aggbug/76486.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-03-13 17:55 <a href="http://www.cppblog.com/jiyuan/archive/2009/03/13/76486.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Copying DNA  PKU3633</title><link>http://www.cppblog.com/jiyuan/archive/2009/03/07/75840.html</link><dc:creator>Lemon</dc:creator><author>Lemon</author><pubDate>Sat, 07 Mar 2009 12:05:00 GMT</pubDate><guid>http://www.cppblog.com/jiyuan/archive/2009/03/07/75840.html</guid><wfw:comment>http://www.cppblog.com/jiyuan/comments/75840.html</wfw:comment><comments>http://www.cppblog.com/jiyuan/archive/2009/03/07/75840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiyuan/comments/commentRss/75840.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiyuan/services/trackbacks/75840.html</trackback:ping><description><![CDATA[<span style="font-size: 14pt;">
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一道搜索好题，着实让我费了不少工夫。</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 先想到了用位表示每个字母是否已经被用过，一共2^n个不同的状态，根据题目意思就画出了一棵搜索树，根部和叶子结点少，中间很胖，就是C(n,1) + C(n, 2) + &#8230; + C(n,n) = 2 ^ n。</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 写了一个DP，字符串的比较用两重循环，记忆化，Run了两个测试数据</p>
<p style="font-size: 10pt; font-family: courier new;">A</p>
<p style="font-size: 10pt; font-family: courier new;">AAAAAAAAAAAAAAAAAA</p>
<p style="font-size: 10pt; font-family: courier new;"><br>GTGTACCTGCAGTTGCAG</p>
<p style="font-size: 10pt; font-family: courier new;">GGTGGCAAGCTATACAAG</p>
<p style="font-size: 10pt; font-family: courier new;"><br>Ans : 6 8</p>
<p style="font-size: 10pt; font-family: courier new;">Time: 2000+MS 2000+MS</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 又写了一个迭代加深的搜索，Run一下，Time: 1400MS 27000MS，第二测试数据的时间简直无法接受，答案的深度加一，时间就飙了一个数量级。</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 又写了BFS广搜，Time: 16MS 500+MS 还是比较满意的，不过还是超时了。我想大概是字符串处理的太慢的，把那段改成用KMP来做，测了下时间更慢了，郁闷~</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 最后想到了A*，测了下15MS 170MS，已经挺满意了，不过还是超时，失望啊~我怀疑STL太慢了，于是自己写了一个堆，结果卡过了，PKU 900MS，呵呵~</p>
<p style="font-size: 10pt; font-family: courier new;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这题让我用尽了浑身解数，把这么多算法都回顾了一遍。我知道，有些地方写得不是很好结果超时了，黄队的博客上写用BFS过的，看来我的搜索能力还有待提高啊~<br></p>
</span><img src ="http://www.cppblog.com/jiyuan/aggbug/75840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiyuan/" target="_blank">Lemon</a> 2009-03-07 20:05 <a href="http://www.cppblog.com/jiyuan/archive/2009/03/07/75840.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>