<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[程序道]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/BalonFan</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; BalonFan]]></copyright><item><title><![CDATA[Be careful of static field when unit testing!]]></title><link>https://blog.csdn.net/BalonFan/article/details/5707181</link><guid>https://blog.csdn.net/BalonFan/article/details/5707181</guid><author>BalonFan</author><pubDate>Thu, 01 Jul 2010 15:46:00 +0800</pubDate><description><![CDATA[<br />Basically, the value of static field will remain across test cases. So either you don't use static field, or remember to reset its value to default value in setUp(). Be careful, or you will get the most tricky bug promisingly.]]></description><category></category></item><item><title><![CDATA[EasyMock: missing behavior definition for the preceeding method call]]></title><link>https://blog.csdn.net/BalonFan/article/details/5706915</link><guid>https://blog.csdn.net/BalonFan/article/details/5706915</guid><author>BalonFan</author><pubDate>Thu, 01 Jul 2010 14:13:00 +0800</pubDate><description><![CDATA[<br />If a method of a class which will be mocked by EasyMock did return some value, you should specify the return value explicitly before you use the mock object in your unit test case. Or else EasyMock will complain:<br /> <br />java.lang.IllegalStateExc]]></description><category></category></item><item><title><![CDATA[EasyMock "m machers expected, n recorded" problem]]></title><link>https://blog.csdn.net/BalonFan/article/details/5706796</link><guid>https://blog.csdn.net/BalonFan/article/details/5706796</guid><author>BalonFan</author><pubDate>Thu, 01 Jul 2010 13:21:00 +0800</pubDate><description><![CDATA[在使用EasyMock时，如果在你的expectation中提供的参数中，有一个是使用了IArgumentMacher提供的，则所有的参数都要使用IArgumentMacher。否则，EasyMock会在这里报错： java.lang.IllegalStateException: M matchers expected, N recorded.比如在下面的场景中：我有一个interface StatusObserver:public interface RunStatusObserver {
  publ]]></description><category></category></item><item><title><![CDATA[106 - Fermat vs. Pythagoras]]></title><link>https://blog.csdn.net/BalonFan/article/details/5214682</link><guid>https://blog.csdn.net/BalonFan/article/details/5214682</guid><author>BalonFan</author><pubDate>Tue, 19 Jan 2010 21:41:00 +0800</pubDate><description><![CDATA[此题实际上是求本原勾股数组（Primitive Pythagorean Triple, PPT）。稍用一点数论的经典知识就可以得到非常高效的解法。我的程序排名18，头一次进第一页：） 返回 Volume I 索引返回总索引 //////////////////////////////////////////////////////////////////////////]]></description><category></category></item><item><title><![CDATA[105 - The Skyline Problem]]></title><link>https://blog.csdn.net/BalonFan/article/details/5135714</link><guid>https://blog.csdn.net/BalonFan/article/details/5135714</guid><author>BalonFan</author><pubDate>Tue, 05 Jan 2010 14:53:00 +0800</pubDate><description><![CDATA[此题比较简单，直接扫描线法处理就可以了。先把每个楼的三元组 (left, height, right) 转化为两个事件：left 转化为进入事件，right 转化为离开事件。然后对所有的事件进行排序后从左向右进行扫描处理：一个楼进入扫描线：加入到“活动楼列表”，如果其 height > currentSkylineHeight，则修改 currentSkylineHeight 为 heig]]></description><category></category></item><item><title><![CDATA[10033 - Interpreter]]></title><link>https://blog.csdn.net/BalonFan/article/details/5132624</link><guid>https://blog.csdn.net/BalonFan/article/details/5132624</guid><author>BalonFan</author><pubDate>Tue, 05 Jan 2010 00:21:00 +0800</pubDate><description><![CDATA[简单模拟题，主要就是“地址”，“地址的地址”，“地址里的数据”这几个概念别搞乱脑子就好。C/C++老手应该闭着眼睛也能写出正确的程序来：） 返回 Volume C 索引返回总索引 //////////////////////////////////////////////////////////////////////////// 10033 - Interpreter]]></description><category></category></item><item><title><![CDATA[10267 - Graphical Editor]]></title><link>https://blog.csdn.net/BalonFan/article/details/5132503</link><guid>https://blog.csdn.net/BalonFan/article/details/5132503</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 23:49:00 +0800</pubDate><description><![CDATA[此题其实是一个简单的模拟题，但经过多次WA后，我终于写对了其中的floodfill算法，要写一个正确的floodFill算法要非常小心。 Floodfill 一般过程就是：将起始点染色，并压入队尾从队列中取出一点 p:(x,y)检测 p 周围4点（或是8点，取决于题目要求是八向还是四向），并将那些可以到达的点染色，并压入队尾循环2~3直到队空我在实现时，出现了几]]></description><category></category></item><item><title><![CDATA[UVa Online Judge - Volume CII 题目和解答索引 ]]></title><link>https://blog.csdn.net/BalonFan/article/details/5132497</link><guid>https://blog.csdn.net/BalonFan/article/details/5132497</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 23:48:00 +0800</pubDate><description><![CDATA[  UVa Online Judge - Volume CII 题目和解答索引。前面为原题链接，后面为我的解答链接。 返回总目录  10267 - Graphical EditorSimulation, FloodfillSolution]]></description><category></category></item><item><title><![CDATA[104 - Arbitrage]]></title><link>https://blog.csdn.net/BalonFan/article/details/5132317</link><guid>https://blog.csdn.net/BalonFan/article/details/5132317</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 23:20:00 +0800</pubDate><description><![CDATA[这道题费了我相当的时间。题目要求找到一个profit > 1.01的套汇序列，但有多个的情况时，要求输出序列最短的一条。 开始觉得很像Floyd-Warshall 算法，但试着开写了才发现，对于怎么控制得到最短序列非常有玄机。最后还是在UVa的论坛里找到了一个好帖，给出了一个 O(n4) 的算法，并给了非常详细的解释。原帖在这里，请看 gits 的回帖。 用 profit(i,]]></description><category></category></item><item><title><![CDATA[挑战编程程序设计竞赛训练手册（Programming Challenges）]]></title><link>https://blog.csdn.net/BalonFan/article/details/5130575</link><guid>https://blog.csdn.net/BalonFan/article/details/5130575</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 17:12:00 +0800</pubDate><description><![CDATA[ 前一阵子到手这本书，一翻开就合不上了，发现书的内容编排非常紧凑，讲解清晰。每一章内容不多，可以一口气读完，每章后面的习题又是从UVa Online Judge上精心挑选的8个题目，自己可以写程序提交验证。可以说是非常适合自学的一本书，强烈推荐！ 这本是一本小册子，但看这本书一定要“把书看厚”。每一章的知识点其实都是很大一堆内容。从这一本小书出发，可以引出算法、数据结构、图论、数论]]></description><category></category></item><item><title><![CDATA[706 - LCD-Display]]></title><link>https://blog.csdn.net/BalonFan/article/details/5130351</link><guid>https://blog.csdn.net/BalonFan/article/details/5130351</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 16:44:00 +0800</pubDate><description><![CDATA[简单模拟题，设计一个好的数据结构来方便的表达每个数字的输出方式。我的不是最好的，后来还看到 Kaipeng Liu 的方法，写起来更利索一些;) 返回 Volume VII 索引返回总索引 下面是我的代码 //////////////////////////////////////////////////////////////////////////// 70]]></description><category></category></item><item><title><![CDATA[UVa Online Judge - Volume VII 题目和解答索引 ]]></title><link>https://blog.csdn.net/BalonFan/article/details/5130298</link><guid>https://blog.csdn.net/BalonFan/article/details/5130298</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 16:38:00 +0800</pubDate><description><![CDATA[  UVa Online Judge - Volume VII 题目和解答索引。前面为原题链接，后面为我的解答链接。 返回总目录  706 - LCD-DisplayStringSolution]]></description><category></category></item><item><title><![CDATA[10137 - The Trip]]></title><link>https://blog.csdn.net/BalonFan/article/details/5130122</link><guid>https://blog.csdn.net/BalonFan/article/details/5130122</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 16:18:00 +0800</pubDate><description><![CDATA[此题涉及浮点数运算，所以要格外小心。题目大意是要求出最小的匀钱方案，精确到分。因此，求出平均数后，用多的减平均数得到的值，和用平均数减少的得到的值可能会有不同。取其中较小的就可以了。特殊情况在于算出的较小的值可能是0，那么就得用较大的值了。 更新：之前对于用C++输出定长浮点数格式控制记不太清了，研究了一下做了修改，现在的科学一些了：cout 返回 Vo]]></description><category></category></item><item><title><![CDATA[10189 - Minesweeper]]></title><link>https://blog.csdn.net/BalonFan/article/details/5129920</link><guid>https://blog.csdn.net/BalonFan/article/details/5129920</guid><author>BalonFan</author><pubDate>Mon, 04 Jan 2010 15:52:00 +0800</pubDate><description><![CDATA[这题不难，根据题意逐行扫描处理就可以了。如果想到使用边沿哨兵可以大大减少处理难度 返回 Volume CI 索引返回总索引  //////////////////////////////////////////////////////////////////////////// 10189 - Minesweeper// Copyright (c) 2010 by ]]></description><category></category></item><item><title><![CDATA[UVa Online Judge - Volume C 题目和解答索引]]></title><link>https://blog.csdn.net/BalonFan/article/details/5125647</link><guid>https://blog.csdn.net/BalonFan/article/details/5125647</guid><author>BalonFan</author><pubDate>Sun, 03 Jan 2010 20:38:00 +0800</pubDate><description><![CDATA[  UVa Online Judge - Volume C 题目和解答索引。前面为原题链接，后面为我的解答链接。 返回总目录  10003 - Cutting SticksDynamic ProgrammingSolution10004 - BicoloringGraph: BFSSolution10006 - Car]]></description><category></category></item><item><title><![CDATA[UVa Online Judge - Volume CI 题目和解答索引]]></title><link>https://blog.csdn.net/BalonFan/article/details/5125612</link><guid>https://blog.csdn.net/BalonFan/article/details/5125612</guid><author>BalonFan</author><pubDate>Sun, 03 Jan 2010 20:28:00 +0800</pubDate><description><![CDATA[  UVa Online Judge - Volume CI 题目和解答索引。前面为原题链接，后面为我的解答链接。 返回总目录  10104 - Euclid ProblemNumber TheorySolution10110 - Light, more lightNumber TheorySolution10137 ]]></description><category></category></item><item><title><![CDATA[103 - Stacking Boxes]]></title><link>https://blog.csdn.net/BalonFan/article/details/5125556</link><guid>https://blog.csdn.net/BalonFan/article/details/5125556</guid><author>BalonFan</author><pubDate>Sun, 03 Jan 2010 20:10:00 +0800</pubDate><description><![CDATA[这个题可以转化为一个有向无环图，在其上寻找一条最长路径。每一个box作为DAG上的一个顶点。如果box1可以嵌套到box2中，则在DAG中有一条有向边从box1指向box2 返回 Volume I 索引返回总索引 //////////////////////////////////////////////////////////////////////////// 10]]></description><category></category></item><item><title><![CDATA[102 - Ecological Bin Packing]]></title><link>https://blog.csdn.net/BalonFan/article/details/5122991</link><guid>https://blog.csdn.net/BalonFan/article/details/5122991</guid><author>BalonFan</author><pubDate>Sun, 03 Jan 2010 00:15:00 +0800</pubDate><description><![CDATA[此题本身不难，因为对于输入，只有6种可能的组合。直接用暴力法枚举所有可能就可以了。主要的问题在于保证输出所有最优解中字典序最少的一个。 返回 Volume I 索引返回总索引 // 102_Ecological_Bin_Packing.cpp : Defines the entry point for the console application.//#i]]></description><category></category></item><item><title><![CDATA[101 - The Blocks Problem]]></title><link>https://blog.csdn.net/BalonFan/article/details/5122973</link><guid>https://blog.csdn.net/BalonFan/article/details/5122973</guid><author>BalonFan</author><pubDate>Sun, 03 Jan 2010 00:10:00 +0800</pubDate><description><![CDATA[模拟题，根据题目描述的内容直接写程序就可以。需要注意的是非法输入的情况：对于a==b或是a和b在同一堆的输入命令直接忽略。 返回 Volume I 索引返回总索引 // 101_The_Blocks_Problem.cpp : Defines the entry point for the console application.//#include #]]></description><category></category></item><item><title><![CDATA[UVa Online Judge - Volume I 题目和解答索引]]></title><link>https://blog.csdn.net/BalonFan/article/details/5122884</link><guid>https://blog.csdn.net/BalonFan/article/details/5122884</guid><author>BalonFan</author><pubDate>Sat, 02 Jan 2010 23:47:00 +0800</pubDate><description><![CDATA[  UVa Online Judge - Volume I 题目和解答索引。前面为原题链接，后面为我的解答链接。 返回总目录  100 - The 3n + 1 problemAd hocSolution101 - The Blocks ProblemSimulationSolution102 - Ecological]]></description><category></category></item></channel></rss>