<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wandsea.com &#187; Program Impossible</title>
	<atom:link href="http://wandsea.com/blog/category/program-impossible/feed" rel="self" type="application/rss+xml" />
	<link>http://wandsea.com/blog</link>
	<description>好吧..大家都要加油哦～</description>
	<lastBuildDate>Fri, 05 Feb 2010 15:30:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>关于C语言,推荐这么几本不错的书</title>
		<link>http://wandsea.com/blog/460.htm</link>
		<comments>http://wandsea.com/blog/460.htm#comments</comments>
		<pubDate>Tue, 05 Jan 2010 15:18:13 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[OI]]></category>
		<category><![CDATA[推荐]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=460</guid>
		<description><![CDATA[推荐时间到了,从Noip结束后一直在学习C语言,来推荐下了..
有点基础的呢,就去看那本&#60;The C Program Language&#62;(C程序设计语言),听了Douban上的某些评论,买了那本英文原版的,可以接受,后来又去上海... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>推荐时间到了,从Noip结束后一直在学习C语言,来推荐下了..</p>
<p>有点基础的呢,就去看那本&lt;The C Program Language&gt;(C程序设计语言),听了Douban上的某些评论,买了那本英文原版的,可以接受,后来又去上海图书馆把翻译版的借了回来,要是只论理解难易度,果然英文的好.</p>
<p>就是有一点,这是关于K&amp;R C的教材,和AnsiC还是有些细微不同的.</p>
<p>然后就是&lt;C陷阱与缺陷&gt;和&lt;C专家编程&gt;.这里面把一些容易忽略的细节整理了一下,还是满值得一读的.其中所写的K&amp;RC和ANSIC的不同点刚好可以补充前一本书.</p>
<p>再然后呢,就多切题吧.....</p>
<p>感觉与Pascal相比,其中指针的作用更加明显了,和系统底层的联系从这里也可以体现出来.</p>
<p>Bless.
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/433.htm" title="Nothing Here 09.09.27">Nothing Here 09.09.27 (10)</a></li>
<li><a href="http://wandsea.com/blog/449.htm" title="最近做的无聊事-FrozenTurtle篇">最近做的无聊事-FrozenTurtle篇 (2)</a></li>
<li><a href="http://wandsea.com/blog/426.htm" title="烟台09.7.14-09.7.23">烟台09.7.14-09.7.23 (8)</a></li>
<li><a href="http://wandsea.com/blog/408.htm" title="随机闲聊网站-Omegle.com">随机闲聊网站-Omegle.com (25)</a></li>
<li><a href="http://wandsea.com/blog/401.htm" title="Nothing Here 09.03.30">Nothing Here 09.03.30 (11)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/460.htm#comments" title="to the comments"><font color="red">加油！已经盖到8楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/460.htm/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>最近做的无聊事-FrozenTurtle篇</title>
		<link>http://wandsea.com/blog/449.htm</link>
		<comments>http://wandsea.com/blog/449.htm#comments</comments>
		<pubDate>Tue, 10 Nov 2009 09:16:46 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[NOIp]]></category>
		<category><![CDATA[OI]]></category>
		<category><![CDATA[动态规划]]></category>
		<category><![CDATA[整理]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=449</guid>
		<description><![CDATA[大多数是水.....部分感觉比较有特点的加*..不定期更新
线性动态规划
VOJ1355 车队过桥问题 f[i]表示前i部通过最短时间,预处理t[i,j]表示i到j的最慢速度,w[i]表示前i部车的重量和,f[i]:=min(f[k]+l/t[k+1,i]... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>大多数是水.....部分感觉比较有特点的加*..不定期更新</p>
<p>线性动态规划<br />
VOJ1355 车队过桥问题 f[i]表示前i部通过最短时间,预处理t[i,j]表示i到j的最慢速度,w[i]表示前i部车的重量和,f[i]:=min(f[k]+l/t[k+1,i])<br />
VOJ1292 火车票 f[i]:=min(f[k]+cost(k,i))<br />
*VOJ1474 雷曼兔(csapc) 排序后类似Lis<br />
VOJ1571 笨笨的导弹攻击 最长上升下降混合子序列...orz<br />
*VOJ1696 爱国者的周期 同上 判断周期用 (f[j]-1)mod(t*2)&lt;t<br />
VOJ1421 更换轮胎 f[i,j]表示第i圈用j种车胎所需最短时间,另开l[i]表示第i圈的最短时间用的车胎号码<br />
*Open09ski 滑雪 f[i,j] 表示于i时间j能力所能得到最多滑雪数 f[i,j]:=max(f[i-1,j],f[i-d[g[i]],j]+1(j&gt;=c[k]),f[i-l[k],0](0为i-l[k]时最大达到))g[i] 表示能力为i时 所能滑的最优轨道号码<br />
VOJ1331 看球的巴士 f[i]:=min(f[j]+1)(abs(s[i]-s[j])&lt;=d)or(abs(s[i]-s[j])=i-j) f[0]=0 f[1]=1<br />
Cai0715-1 一起去打cs f[i,j]:=min(f[i-1,j]+b[i],f[i-1,j-a[i]]) 状态 完成i-1件作业耗甲j时间时,所需乙最短时间 决策 第i件交给谁做<br />
VOJ1118 统计字符串 预处理g[i,j] i-j间字符串个数<br />
*VOJ1037 搭建双塔 f[i-1,j] 不放   f[i-1,j+h[i]]  放到矮塔仍为矮塔   f[i-1,h[i]-j]+j  放到矮塔变成高塔   f[i-1,j-h[i]]+h[i]  放到高塔</p>
<p>背包问题<br />
VOJ1625 精卫填海(HOI) 01背包<br />
VOJ1418 公司聚会 倒推01背包 f[p[i],j]:=max(f[p[i],j],f[p[i],j-k]+f[i,k]),最后判断职人1号是否更优.<br />
VOJ1544 GF 裸两维背包<br />
VOJ1392 拼拼图的小杉 伪01背包 f[i,j]表示前i件物品选j件,所需最小集合数,g[i,j]表示最后一个集合已填充容量<br />
VOJ1198 最佳课题选择 f[i,j] 前i种论文完成j件所需最短时间 f[i,j]:=min(f[i-1,k]+a[i]*(j-k)^b[i]) 0&lt;=k&lt;=j (分组背包也可做)<br />
*VOJ1313 金明的预算方案 有依赖背包-&gt;分组背包</p>
<p>树形动态规划<br />
*VOJ1180 选课 基础树形.f[k,t]:=max(f[r[k],t],max(f[l[k],t-1-i]+f[r[k],i]+s[k])) (i=1..t-1)</p>
<p>区间动态规划<br />
*VOJ1242 邮局问题 f[i,j] 1到i的村庄,修j个邮局的最小距离,预处理d[i,j],表示于i,j中点修建的距离和,f[i,j]:=min(f[k,j-1]+d[k+1,i])<br />
*VOJ1347 乘积最大 f[i,j]:=max(f[k,j-1]*s[k+1,i])<br />
VOJ1218 数字游戏 预处理s数组后同乘积最大 f[i,j]:=max(f[k,j-1]*s[k+1,i])</p>
<p>多进程动态规划<br />
VOJ1493 传纸条 f[i,j,k]第i步,A的x位置于j,B的x位置为k的最大值<br />
*VOJ1143 三取方格数 同上,四维,第一维可用循环数组消去.<br />
*VOJ1014 旅行商简化 f[i,j]:=min(f[j,j-1]+s[j-1,i],f[i,j-1]+s[j-1,j]) (i&gt;=j) f[i,j]=f[j,i] 避免跳过路程,必须从近的一点j进行扩展<br />
VOJ1680 距离 字符串距离  f[i,j]:=min(f[i-1,j-1]+d[i,j],f[i-1,j]+k,f[i,j-1]+k)<br />
VOJ1111 水果店 总长度-最长公共子序列</p>
<p>状态压缩<br />
*VOJ1424 炮兵阵地 把每一行状态用二进制存储于一个longint中,预处理每一行可能摆放,存于p[i,j],由于一行只与前两行有关,<br />
f[i,j,k]:=max(f[i-1,k,t]+addnum(p[i,j])) f[i,j,k] 表示到第i行,第i行摆放为p[i,j],第i-1行为p[i-1,k] 时的最多炮兵数<br />
Matrix67-0817 多米诺 类似上一题,状态压缩每一行状态,70分</p>
<p>递推<br />
VOJ1232 核电站问题 连续N个东西,不能选连续m个的选法总数<br />
VOJ1408 古韵之乞巧 f[i,k+1]:=f[i,k+1]+f[j,k] 以s[i]结尾的长为k+1的方案数</p>
<p>记忆化搜索<br />
VOJ1547 逆转，然后再见 诡异的记忆化搜索..<br />
VOJ1011 滑雪 同上
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/460.htm" title="关于C语言,推荐这么几本不错的书">关于C语言,推荐这么几本不错的书 (8)</a></li>
<li><a href="http://wandsea.com/blog/433.htm" title="Nothing Here 09.09.27">Nothing Here 09.09.27 (10)</a></li>
<li><a href="http://wandsea.com/blog/426.htm" title="烟台09.7.14-09.7.23">烟台09.7.14-09.7.23 (8)</a></li>
<li><a href="http://wandsea.com/blog/352.htm" title="11.15 NOIp2008">11.15 NOIp2008 (15)</a></li>
<li><a href="http://wandsea.com/blog/309.htm" title="OI与追MM的联系">OI与追MM的联系 (4)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/449.htm#comments" title="to the comments"><font color="red">加油！已经盖到2楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/449.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>一个Twitter签名图片生成脚本</title>
		<link>http://wandsea.com/blog/420.htm</link>
		<comments>http://wandsea.com/blog/420.htm#comments</comments>
		<pubDate>Thu, 20 Aug 2009 01:00:16 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=420</guid>
		<description><![CDATA[一直都没有找到合适的Twitter签名图片,国外的遇到中文都成了口口,国内以前有过一个,但后来作者好像关闭了服务.
你需要的是一个国外的(别问我为什么)php服务器,支持gd库和curl就可以,完成效果... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>一直都没有找到合适的Twitter签名图片,国外的遇到中文都成了口口,国内以前有过一个,但后来作者好像关闭了服务.</p>
<p>你需要的是一个国外的(别问我为什么)php服务器,支持gd库和curl就可以,完成效果如下:</p>
<blockquote><p><img src="http://wandsea.com/twitter/s1.png" alt="" /></p></blockquote>
<p>用了一个Twitter的php库,很方便,背景图片是用的fanfou的那个作为样本的,头像图片从Twitter获取,下载代码后只需要更改自己的用户名,并上传一个ttf字体文件即可.</p>
<p>把他做成静态的,这样就可以节约许多服务器资源,用cron新建一个任务,半小时curl这个页面一次.</p>
<p>暂且就是这样了,<del datetime="2009-07-09T01:10:44+00:00">贴代码,第一次用Syntax Highlighter这个插件,顺便试一下</del>js载入太多,放弃..</p>
<p>打包下载地址:<a href="http://wandsea.com/down/twitter-sig.tar.gz">http://wandsea.com/down/twitter-sig.tar.gz</a>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/399.htm" title="WandShare链接分享V0.1">WandShare链接分享V0.1 (5)</a></li>
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/366.htm" title="将你的Feed同步到Twitter＆Fanfou">将你的Feed同步到Twitter＆Fanfou (3)</a></li>
<li><a href="http://wandsea.com/blog/253.htm" title="更改Wordpress的默認搜索框">更改Wordpress的默認搜索框 (2)</a></li>
<li><a href="http://wandsea.com/blog/161.htm" title="Wordpress密碼保護無法使用">Wordpress密碼保護無法使用 (9)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/420.htm#comments" title="to the comments"><font color="red">加油！已经盖到7楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/420.htm/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Ubuntu下给照片批量添加EXIF信息水印</title>
		<link>http://wandsea.com/blog/428.htm</link>
		<comments>http://wandsea.com/blog/428.htm#comments</comments>
		<pubDate>Sun, 26 Jul 2009 12:52:31 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[图像]]></category>
		<category><![CDATA[照片]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=428</guid>
		<description><![CDATA[给照片加水印的工具有很多,以前一直用的Windows Live Writer就能做出很漂亮的水印效果,到了Ubuntu下,还没看到什么类似的工具&#62;_&#60;(是我懒得找了...)
耗时1H,找了好多关于Imagemagick的文章,发现这... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>给照片加水印的工具有很多,以前一直用的Windows Live Writer就能做出很漂亮的水印效果,到了Ubuntu下,还没看到什么类似的工具&gt;_&lt;(是我懒得找了...)</p>
<p>耗时1H,找了好多关于Imagemagick的文章,发现这东西真有用..对于命令行下的图象处理十分方便,再加上exif工具,用来读取照片exif标签,这东西源里有.</p>
<p>脚本在这里下载: <a href="http://wandsea.com/down/exif.sh">http://wandsea.com/down/exif.sh</a></p>
<p>下载回来,改下自己的名字,换一下字体地址,进入照片目录</p>
<blockquote><p>for i in *.JPG; do ./exif.sh $i ;done</p></blockquote>
<p>会自动建立备份目录,在原图上进行水印操作.</p>
<p>制作完水印的效果:</p>
<blockquote><p><img class="alignnone size-medium wp-image-429" title="水印效果-1" src="http://wandsea.com/blog/wp-content/uploads/2009/07/test1-450x337.jpg" alt="水印效果-1" width="450" height="337" /></p>
<p><img class="alignnone size-medium wp-image-430" title="水印效果-2" src="http://wandsea.com/blog/wp-content/uploads/2009/07/test2-363x450.jpg" alt="水印效果-2" width="363" height="450" /></p></blockquote>
<p>Canon EOS系列......还有一年.....- -....现在这相机亮点还好,一到晚上开高iso...惨不忍睹呃....</p>
<p>今天打开页面..更囧..</p>
<blockquote><p><img class="alignnone size-full wp-image-431" title="screenshot_003" src="http://wandsea.com/blog/wp-content/uploads/2009/07/screenshot_003.png" alt="screenshot_003" width="190" height="220" /></p></blockquote>
<p>这Adsence匹配......OrzOrz
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/417.htm" title="Ubuntu 9.04 新通知机制 -Notify-send ">Ubuntu 9.04 新通知机制 -Notify-send  (1)</a></li>
<li><a href="http://wandsea.com/blog/399.htm" title="WandShare链接分享V0.1">WandShare链接分享V0.1 (5)</a></li>
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/446.htm" title="Ubuntu 9.10 (RC) 音量过大 Bug修复">Ubuntu 9.10 (RC) 音量过大 Bug修复 (4)</a></li>
<li><a href="http://wandsea.com/blog/426.htm" title="烟台09.7.14-09.7.23">烟台09.7.14-09.7.23 (8)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/428.htm#comments" title="to the comments"><font color="red">加油！已经盖到8楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/428.htm/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Firefox3.5PGO手动编译笔记</title>
		<link>http://wandsea.com/blog/422.htm</link>
		<comments>http://wandsea.com/blog/422.htm#comments</comments>
		<pubDate>Wed, 01 Jul 2009 07:41:31 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[pgo]]></category>
		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=422</guid>
		<description><![CDATA[无聊无趣之作....&#62;_&#60;
耗时n*2小时(每编译一次2小时,编译n次)...主要是gcc的 -O3,选用就会随机出现奇异错误,我机器烂..
编译环境ubuntu9.04+gcc-4.4套装.
首先安装gcc-4.4,有deb包,在ubuntu源里搜索的到... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>无聊无趣之作....&gt;_&lt;</p>
<p>耗时n*2小时(每编译一次2小时,编译n次)...主要是gcc的 -O3,选用就会随机出现奇异错误,我机器烂..</p>
<p>编译环境ubuntu9.04+gcc-4.4套装.</p>
<p>首先安装gcc-4.4,有deb包,在ubuntu源里搜索的到(我说是9.10的源)..传闻说会有速度提升</p>
<p>要是没事情做的话,也可以下载源码包,先用4.3编译4.4,然后再用4.4编译自己一遍...</p>
<p id="title">PGO,就是Profile-Guided Optimization,根据配置文件编译,详解--<a href="http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/f27a0849-0508-41b0-809c-fa410c031e88/" target="_blank">http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/f27a0849-0508-41b0-809c-fa410c031e88/</a></p>
<p>先下载firefox的最新源码,<a href="ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.5/source/firefox-3.5-source.tar.bz2">ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest-3.5/source/firefox-3.5-source.tar.bz2</a> ,解压到某个文件夹,磁盘空间要充足,大概1G不到点.</p>
<p>开始写编译配置.我是参考 <a href="http://oranqe.wordpress.com/2009/03/10/the-way-to-build-pgo-fx/" target="_blank">http://oranqe.wordpress.com/2009/03/10/the-way-to-build-pgo-fx/</a> 这篇文章的,(怎么看文章自己看着办)</p>
<p>创建<a href="http://emukim.googlepages.com/mozconfig"><strong>.mozconfig</strong></a> (你就下载这文件好了),开始修改,我的是这样的</p>
<blockquote><p>. $topsrcdir/browser/config/mozconfig<br />
<span style="color: #3366ff;">CC=gcc-4.4<br />
CXX=g++-4.4<br />
CPP=cpp-4.4</span><span style="color: #ff0000;"> </span><br />
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@<br />
ac_add_options --disable-tests --disable-crashreporter --disable-debug --disable-tests --disable-javaxpcom --disable-updater<br />
ac_add_options --enable-application=browser --enable-jemalloc<br />
ac_add_options --enable-optimize="<span style="color: #ff00ff;">-O2</span> -fforce-addr <span style="color: #ff9900;">-march=native -mtune=native</span> -pipe -fomit-frame-pointer"<br />
ac_add_options --enable-profile-guided-optimization<br />
mk_add_options PROFILE_GEN_SCRIPT=”sh /home/wandsea/run-firefox.sh”(这里改下目录)<br />
<span style="color: #99cc00;">#make -f client.mk profiledbuild</span></p></blockquote>
<p>再创建一个文件<strong><a href="http://emukim.googlepages.com/run-firefox.sh"><strong>run-firefox.sh</strong></a></strong></p>
<blockquote><p>#!/bin/sh <span style="color: #99cc00;">make -f client.mk profiledbuild</span><br />
export NO_EM_RESTART=1<br />
mkdir $OBJDIR/_profileprofile<br />
$OBJDIR/dist/bin/firefox -no-remote -profile $OBJDIR/_profileprofile</p></blockquote>
<p>检查下,没什么问题就进终端<span style="color: #99cc00;"> make -f client.mk profiledbuild</span></p>
<p>想干什么就干什么去吧...需要编译两次,第一次结束后会自动打开firefox,(所以编译的时候旧版别开..否则出错),进行配置文件的生成,随便看点经常上的网站,js测试测试,大的小的都看看,然后关闭,继续编译..</p>
<p>全部搞定后,cd obj-i686-pc-linux-gnu;make package</p>
<p>把生成的文件复制出来就好了,现在是英文版,所以再进行中文化工作</p>
<p>下载个官方编译好的中文版,解压好里面有一个chrome文件夹,打开,zh-CN的那两个复制到自己编译的版本的相同位置,删掉里面en-US的两个,打开应该就是中文版的了.(图标也是相同办法)</p>
<p>locale还没改,插件就还是英文的,about:config,搜索general.useragent.locale,改成zh-CN,顺便把浏览器</p>
<p>general.useragent.extra.firefox,改成Firefox/3.5,应该就好了.</p>
<p>找个评测网站,试试自己的成果,呃..我的比原版3.5的js分数提升了17%....然后又用那个开发中的chromium试了下..50%...然后我就无语了.....</p>
<p>纯属无趣+无聊的东西..退散吧....</p>
<p><span style="text-decoration: line-through;">PS:谁知道怎样让wordpress不换双引号,不把--换成-.....无语了</span></p>
<p>(Thanks <cite><span id="edit-author1645"><a rel="external nofollow" href="http://leafduo.com/blog/">leafduo</a></span></cite> 问题解决了,Quotmarks Replacer很好用.)</p>
<p>PS2:对于IE无视了,模板边栏下沉,链接都不会自己换行..还是IE8..
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/276.htm" title="Mozilla之书">Mozilla之书 (2)</a></li>
<li><a href="http://wandsea.com/blog/218.htm" title="一個Firefox的衍生版-Lolifox">一個Firefox的衍生版-Lolifox (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/422.htm#comments" title="to the comments"><font color="red">加油！已经盖到6楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/422.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WandShare链接分享V0.1</title>
		<link>http://wandsea.com/blog/399.htm</link>
		<comments>http://wandsea.com/blog/399.htm#comments</comments>
		<pubDate>Sat, 07 Mar 2009 13:16:36 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[分享]]></category>
		<category><![CDATA[网络]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[饭否]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=399</guid>
		<description><![CDATA[最近在学bash，就老写这种小程序－－
其实没什么技术含量，API都是提供好的，本还以为是要用服务器／客户端结构的，后来居然发现Firefox可以直接执行本地程序...
WandShare链接分享V0.1使用说明... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>最近在学bash，就老写这种小程序－－<br />
其实没什么技术含量，API都是提供好的，本还以为是要用服务器／客户端结构的，后来居然发现Firefox可以直接执行本地程序...</p>
<blockquote><p>WandShare链接分享V0.1使用说明<br />
本脚本用来把当前打开的页面分享到Twitter＆饭否上<br />
Linux＋Firefox，很简陋，本是自己用的，就懒得加美化了，没有任何提示，全自动完成...<br />
理论上bash改成批处理，Windows也可以使用，但没测试环境，呵呵，别的浏览器大概就不可以了..<br />
首先下载WandShareV0.1.tar.gz<br />
解压缩后放在某个文件夹里，打开Share_Sender.sh，更改用户名密码<br />
然后打开另一个文件，更改脚本位置，然后把内容复制到浏览器的书签地址里<br />
打开about:config，signed.applets.codebase_principal_support的属性值设置为true<br />
完成</p></blockquote>
<p>下载地址：<a href="http://wandsea.com/down/WandShareV0.1.tar.gz">http://wandsea.com/down/WandShareV0.1.tar.gz</a><br />
就这样了吧～Twitter居然不让个人Blog申请API ID...BS下...大家其实也可以自己申请个Fanfou的ID，很快就能搞定的
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/428.htm" title="Ubuntu下给照片批量添加EXIF信息水印">Ubuntu下给照片批量添加EXIF信息水印 (8)</a></li>
<li><a href="http://wandsea.com/blog/417.htm" title="Ubuntu 9.04 新通知机制 -Notify-send ">Ubuntu 9.04 新通知机制 -Notify-send  (1)</a></li>
<li><a href="http://wandsea.com/blog/366.htm" title="将你的Feed同步到Twitter＆Fanfou">将你的Feed同步到Twitter＆Fanfou (3)</a></li>
<li><a href="http://wandsea.com/blog/437.htm" title="上海电信又开始强行插广告了&#8230;">上海电信又开始强行插广告了&#8230; (10)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/399.htm#comments" title="to the comments"><font color="red">加油！已经盖到5楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/399.htm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>一个&quot;正在播放&quot;信息发布器</title>
		<link>http://wandsea.com/blog/397.htm</link>
		<comments>http://wandsea.com/blog/397.htm#comments</comments>
		<pubDate>Sun, 22 Feb 2009 14:15:31 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[网络]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=397</guid>
		<description><![CDATA[这名字起得真纠结，Wandsea's"正在播放"信息发布器.......
Update 09-02-24: V0.3发布 更新试听功能，去除文字多余符号，使其更为美观
常来的同学也许已经看到了，在我的Widget栏中把8box换成了现在的... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>这名字起得真纠结，Wandsea's"正在播放"信息发布器.......</p>
<p><strong>Update 09-02-24: V0.3发布 更新试听功能，去除文字多余符号，使其更为美观</strong></p>
<p>常来的同学也许已经看到了，在我的Widget栏中把8box换成了现在的正在播放信息发布，这用的就是本文的这个小脚本（应该不能算软件.....－－），耗时不长，也很简单，主要是利用了前几天的一个显示歌词的脚本中的一个函数，自己编一定很困难...开源就是好，能很好地避免重复劳动，呵呵～</p>
<p>首先从系统中读取现在播放的歌曲信息，经过去空格等操作后利用Get方式与密钥一起发送到服务器段的php脚本上，这个php脚本会把传送过来的密钥与自己存储的密钥进行比对，如一致，则去除html标签（防黑）后保存到服务器上的一个文本文件中，之后打开网页时就从此文本文件中读取内容以及文件最后修改时间并显示出来....就这样....很简单...</p>
<p>支持的播放器有Audicious,Rhythmbox(已测试)，mpc,amarok(理论可以)...当然了，Linux下使用</p>
<p>压缩包内一共四个文件，首先修改各个文件中的各个变量（密钥、服务器地址以及文本文件地址），然后把music_add.php传送到服务器端，music_get.php中的内容复制到你所要显示信息的地方，在终端中运行music_sender_main.sh就可以了。</p>
<p>其他还可以定制的有发布格式，更新间隔等等...（废话...都开源的什么还不能改）</p>
<blockquote><p>本软件采取GPL协议发布，用来发送本地正在播放的歌曲名称到服务器上并在页面上显示出来，这个小程序在本地使用Bash+Python，服务器端使用PHP，主要部分参考自UbuntuForum上的歌词显示插件<br />
作者：Wandsea (2009-02-22)<br />
联系方式：Wandsea [at] gmail.com<br />
网站：http://Wandsea.com/<br />
再次感谢开源社区为我提供如此便利的方式来编写程序！</p></blockquote>
<p>下载地址:<a href="http://wandsea.com/down/Wandsea's_Music_Infomation_Sender_V0.3.tar.gz">http://wandsea.com/down/Wandsea's_Music_Infomation_Sender_V0.3.tar.gz</a></p>
<p>欢迎提出修改意见，有修改好的也可以发送给我，呵呵～
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/399.htm" title="WandShare链接分享V0.1">WandShare链接分享V0.1 (5)</a></li>
<li><a href="http://wandsea.com/blog/428.htm" title="Ubuntu下给照片批量添加EXIF信息水印">Ubuntu下给照片批量添加EXIF信息水印 (8)</a></li>
<li><a href="http://wandsea.com/blog/417.htm" title="Ubuntu 9.04 新通知机制 -Notify-send ">Ubuntu 9.04 新通知机制 -Notify-send  (1)</a></li>
<li><a href="http://wandsea.com/blog/155.htm" title="Php單詞日記&amp;留言簿">Php單詞日記&amp;留言簿 (1)</a></li>
<li><a href="http://wandsea.com/blog/437.htm" title="上海电信又开始强行插广告了&#8230;">上海电信又开始强行插广告了&#8230; (10)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/397.htm#comments" title="to the comments"><font color="red">加油！已经盖到4楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/397.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Win32 Emacs 配置</title>
		<link>http://wandsea.com/blog/259.htm</link>
		<comments>http://wandsea.com/blog/259.htm#comments</comments>
		<pubDate>Fri, 08 Aug 2008 03:38:25 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[软件]]></category>

		<guid isPermaLink="false">Ubuntu下編程序用Emacs習慣了，WinXP的IDE倒用起來不順手了，<a href="http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl">下載</a>了一個(Patched的那個)～

剛下載下來的的當然不能直接用了，除非你受得了那奇怪的字體= =

.emacs是emacs的配置文件，Win32下在 C:\Documents and Settings\你的用戶名\Application Data下

下面這個是我參考了N多人的帖</guid>
		<description><![CDATA[Ubuntu下編程序用Emacs習慣了，WinXP的IDE倒用起來不順手了，下載了一個(Patched的那個)～
剛下載下來的的當然不能直接用了，除非你受得了那奇怪的字體= =
.emacs是emacs的配置文件，Win32下在 C:\Docume... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>Ubuntu下編程序用Emacs習慣了，WinXP的IDE倒用起來不順手了，<a href="http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl">下載</a>了一個(Patched的那個)～</p>
<p>剛下載下來的的當然不能直接用了，除非你受得了那奇怪的字體= =</p>
<p>.emacs是emacs的配置文件，Win32下在 C:\Documents and Settings\你的用戶名\Application Data下</p>
<p>下面這個是我參考了N多人的帖子寫出來的配置，呵呵，<a href="http://forum.ubuntu.org.cn/">Ubuntu中文論壇</a>，<a href="http://evalls.yo2.cn/">Evalls</a>，謝謝了</p>
<p>這個配置適合pascal環境，自定義了F5關閉窗口，F7單步，F8單步，F9編譯，F10GDB</p>
<p><a href="http://code.google.com/p/myemacsconf/source/browse/trunk/.emacs.d/load-path/fontset-win.el?r=10">fontset-win</a>和<a href="https://gna.org/projects/color-theme">color-theme</a>自己到網上去下載一下吧，保存到下面的那個位置，一個是改字體的，另一個是改顏色配置的</p>
<p align="center"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://wandsea.com/blog/wp-content/uploads/2008/08/emacs23.jpg" border="0" alt="emacs2" width="204" height="258" /><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://wandsea.com/blog/wp-content/uploads/2008/08/emacs1.jpg" border="0" alt="emacs" width="304" height="236" /> <span id="more-259"></span></p>
<blockquote><p>(custom-set-variables<br />
'(appmenu-mode t)<br />
'(column-number-mode t)<br />
'(cua-mode t nil (cua-base))<br />
'(display-time-mode t)<br />
'(emacsw32-max-frames t)<br />
'(emacsw32-style-frame-title t)<br />
'(hfyview-quick-print-in-files-menu t)<br />
'(menuacc-mode t)<br />
'(noprint-hide-print-in-menus t)<br />
'(noprint-hide-ps-print-in-menus t)<br />
'(ourcomments-ido-ctrl-tab t)<br />
'(rebind-keys-mode t)<br />
'(recentf-mode t)<br />
'(show-paren-mode t)<br />
'(tabkey2-mode t)<br />
'(w32-meta-style (quote w32-lr))<br />
'(w32shell-shell (quote cmd)))</p>
<p>( global-font-lock-mode t)</p>
<p>( display-time )</p>
<p>( column-number-mode t)</p>
<p>(defun quick-compile ()<br />
"A quick compile funciton for pascal"<br />
( interactive )<br />
( compile (concat "fpc " (buffer-name (current-buffer)) " -Sg -Si -Sa -Mfpc -Cr -Ci -Co -CR -Og -Op2 -g"))<br />
)<br />
( global-set-key [(f9)] 'quick-compile)</p>
<p>( global-set-key [(f5)] 'delete-other-windows)</p>
<p>( global-set-key [(f10)] 'gdb)</p>
<p>( global-set-key [(f8)] 'gud-next )<br />
( global-set-key [(f7)] 'gud-step )</p>
<p>(global-font-lock-mode t);语法高亮<br />
(auto-image-file-mode t);打开图片显示功能<br />
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no，可能你觉得不需要，呵呵。<br />
(column-number-mode t);显示列号<br />
(show-paren-mode t);显示括号匹配<br />
(display-time-mode 1);显示时间，格式如下<br />
(setq display-time-24hr-format t)<br />
(setq display-time-day-and-date t)<br />
(tool-bar-mode nil);去掉那个大大的工具栏<br />
(scroll-bar-mode nil);去掉滚动条，因为可以使用鼠标滚轮了 ^_^<br />
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时，让鼠标指针自动让开，别挡住视线。很好玩阿，这个功能<br />
(transient-mark-mode t);这个忘了，郁闷！<br />
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴<br />
(setq frame-title-format "Wandsea@%b");在标题栏提示你目前在什么位置。你要把zhan改成自己的用户名<br />
(setq default-fill-column 80);默认显示 80列就换行</p>
<p>(load-file "C:/Program Files/Emacs/color-theme.el")<br />
(color-theme-blue-mood);选择 darkblue的配色方案<br />
(load-file "C:/Program Files/Emacs/fontset-win.el")<br />
(load "fontset-win")<br />
(huangq-fontset-monaco 11)</p></blockquote>
<p>那圖片，怨念的題目，ansistring= =
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/446.htm" title="Ubuntu 9.10 (RC) 音量过大 Bug修复">Ubuntu 9.10 (RC) 音量过大 Bug修复 (4)</a></li>
<li><a href="http://wandsea.com/blog/302.htm" title="Battle for Wesnoth 韦诺之战">Battle for Wesnoth 韦诺之战 (2)</a></li>
<li><a href="http://wandsea.com/blog/351.htm" title="Ubuntu 8.10 Intrepid 更新完毕">Ubuntu 8.10 Intrepid 更新完毕 (13)</a></li>
<li><a href="http://wandsea.com/blog/331.htm" title="Ubuntu LaTeX 配置记">Ubuntu LaTeX 配置记 (4)</a></li>
<li><a href="http://wandsea.com/blog/318.htm" title="Ubuntu的主菜单打不开了">Ubuntu的主菜单打不开了 (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/259.htm#comments" title="to the comments"><font color="red">加油！已经盖到3楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/259.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>更改Wordpress的默認搜索框</title>
		<link>http://wandsea.com/blog/253.htm</link>
		<comments>http://wandsea.com/blog/253.htm#comments</comments>
		<pubDate>Thu, 07 Aug 2008 12:56:15 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[站务]]></category>

		<guid isPermaLink="false">由于不知道為什么的原因，突然感覺原來的模板過于死氣沉沉，但又不想換模板，因為現在的模板已經被我改動了好多，換一個新的模板又要重新改，所以就開始修改原來的模板了。

好廢話= =

好吧，懶得重啟電腦，Ubuntu下完成，Gimp功能還算可以，用起來也蠻順手，把原來那些死氣沉沉的Css也用Emacs全部修<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-w</guid>
		<description><![CDATA[由于不知道為什么的原因，突然感覺原來的模板過于死氣沉沉，但又不想換模板，因為現在的模板已經被我改動了好多，換一個新的模板又要重新改，所以就開始修改原來的模板了。
好廢話= =
... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>由于不知道為什么的原因，突然感覺原來的模板過于死氣沉沉，但又不想換模板，因為現在的模板已經被我改動了好多，換一個新的模板又要重新改，所以就開始修改原來的模板了。</p>
<p>好廢話= =</p>
<p>好吧，懶得重啟電腦，Ubuntu下完成，Gimp功能還算可以，用起來也蠻順手，把原來那些死氣沉沉的Css也用Emacs全部修<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://wandsea.com/blog/wp-content/uploads/2008/08/qq.jpg" border="0" alt="Google 自定義搜索" width="150" height="312" align="right" />改了一下，就成了現在這個樣子，改名叫 Bright Final3.0 = = ，原來是Dark Final 2.0，由于自己把模板已經改得不像樣了，所以就不提供下載啦，如果你有耐心，E-mail索取或是修改原版主題都可以。</p>
<p>切入正題= =</p>
<p>wordpress默認的搜索是查詢自己的數據庫，只能查找文章，而且速度慢，剛好改主題，搜索框也改一下吧，Google提供的站點搜索服務，突然發現現在可以把搜索結果放在一個iframe里，然后放在自己的網站里，很和諧，哈哈～</p>
<p>我是注冊過Google AdSense的，如果沒有注冊，好像<a href="http://www.google.com/coop/cse/">Google自定義搜索</a>也是可以的，但都需要Google帳號，說說我的吧，Google 搜索廣告，設定好各項參數，會生成兩段代碼，一段是搜索框，我用這段代碼替換了原來Header的搜索，然后把另外一個接受搜索關鍵詞的代碼放在一個<a href="www.wandsea.com/blog/search">新創建的頁面</a>中，順便也在<a href="www.wandsea.com/blog/search">那個頁面</a>中也放了一個搜索框，呵呵，沒超過Google的要求2個，生成的頁面風格和我的Bo很搭的呢～</p>
<p>繼續跑題，寫了一個PHP計數器.<span id="more-253"></span></p>
<blockquote><p>&lt;?php</p>
<p>/***<strong>© 2008 | Wandsea’Blog </strong>All Right Reserved.</p>
<p><a href="http://wandsea.com/">http://wandsea.com/</a></p>
<p>PHP文字計數器V0.1***/<br />
session_start();<br />
$counterFile = "保存文件的地址";<br />
function displayCounter($counterFile) {<br />
$fp = fopen($counterFile,"rw");<br />
$num = fgets($fp,5);</p>
<p>if (!(preg_match("/('Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla')/", $_SERVER['HTTP_USER_AGENT']))) { //厚道一點，把搜索引擎Bot排除，一個晚上居然有50多個bot流量<br />
if (!(isset($_SESSION["visit"]) &amp;&amp; $_SESSION["visit"] === true)) {</p>
<p>//保證一次瀏覽只增加一次訪問量<br />
$num += 1;<br />
$_SESSION["visit"] = true;<br />
} }<br />
print "---第 "."$num"." 位访问本站的同学，欢迎留言~";<br />
exec( "rm -rf $counterFile");<br />
exec( "echo $num-&gt; $counterFile");<br />
}<br />
if (!file_exists($counterFile)) {<br />
exec( "echo 0 -&gt; $counterFile");<br />
}<br />
displayCounter($counterFile);<br />
?&gt;</p></blockquote>
<p>很簡易，呵呵，能用就行啊～</p>
<p>PS:我新建計數器的基數是589，是我Clicki統計加上被屏蔽的一段時間用的Google統計得出的結果，始自2008-04-02
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/339.htm" title="Google PR 更新啦！">Google PR 更新啦！ (15)</a></li>
<li><a href="http://wandsea.com/blog/230.htm" title="神奇的流量">神奇的流量 (2)</a></li>
<li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本 (7)</a></li>
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/393.htm" title="解决Feedsky 704解析错误问题">解决Feedsky 704解析错误问题 (4)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/253.htm#comments" title="to the comments"><font color="red">加油！已经盖到2楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/253.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress密碼保護無法使用</title>
		<link>http://wandsea.com/blog/161.htm</link>
		<comments>http://wandsea.com/blog/161.htm#comments</comments>
		<pubDate>Tue, 15 Jul 2008 17:38:34 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false"><p>前一段時間，給幾篇文章加上了訪問密碼，然后無論怎么輸入密碼，IE7和火狐都打不開。</p> <p>然后一狠心，把插件一個個都關閉打開，最終發現原來是首字下沉這個插件造成的問題。</p> <p>這就好辦了，打開PHP文件，慢慢修改，如下。</p> <blockquote> <p>function drop_cap ($content) { </p> <p>&nbsp;&nbsp;&nbsp; global $post;&nbsp;&nbsp; //從這里開始更改</p> <p>&nbsp;&nbsp;</guid>
		<description><![CDATA[前一段時間，給幾篇文章加上了訪問密碼，然后無論怎么輸入密碼，IE7和火狐都打不開。
然后一狠心，把插件一個個都關閉打開，最終發現原來是首字下沉這個插件造成的問題。
這就好辦了，... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>前一段時間，給幾篇文章加上了訪問密碼，然后無論怎么輸入密碼，IE7和火狐都打不開。</p>
<p>然后一狠心，把插件一個個都關閉打開，最終發現原來是首字下沉這個插件造成的問題。</p>
<p>這就好辦了，打開PHP文件，慢慢修改，如下。</p>
<blockquote><p>function drop_cap ($content) { </p>
<p>&nbsp;&nbsp;&nbsp; global $post;&nbsp;&nbsp; //從這里開始更改</p>
<p>&nbsp;&nbsp;&nbsp; $p = get_post($post-&gt;ID);</p>
<p>&nbsp;&nbsp;&nbsp; if ( !empty($post-&gt;post_password) )&nbsp;&nbsp; // 如果有密碼保護，直接輸出內容&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp; { </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $content;</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; else</p>
<p>&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; //到這里結束 ，最后加上一個“}”，完成</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $newContent = explode("&lt;/p&gt;", $content); </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $newContent1 = explode("&lt;p&gt;", $newContent[0]); </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 如果第一个字母不是 &lt;，就进行首字下沉处理，否则就输出原始内容。这样做，是为了避免一些显示问题。 PS：已經考慮到Html代碼了，嘿嘿～</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (substr($newContent1[1],0,1)!='&lt;') { </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bufContent = "&lt;p class='fp'&gt;".$newContent1[1]."&lt;/p&gt;"; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for($i = 1; $i &lt; count($newContent); $i ++){ </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bufContent .= $newContent[$i] . '&lt;/p&gt;'; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Return the updated markup </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $bufContent; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $content;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>} </p>
</blockquote>
<p>如想省事，請直接下載以下文件。</p>
<p><a href="http://wandsea.com/down/dropcap.rar" target="_blank">Dropcap 修改版</a></p>
<p>下載完解壓放入插件文件夾啟用即可</p>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/393.htm" title="解决Feedsky 704解析错误问题">解决Feedsky 704解析错误问题 (4)</a></li>
<li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本 (7)</a></li>
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/253.htm" title="更改Wordpress的默認搜索框">更改Wordpress的默認搜索框 (2)</a></li>
<li><a href="http://wandsea.com/blog/155.htm" title="Php單詞日記&amp;留言簿">Php單詞日記&amp;留言簿 (1)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/161.htm#comments" title="to the comments"><font color="red">加油！已经盖到9楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/161.htm/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Php單詞日記&amp;留言簿</title>
		<link>http://wandsea.com/blog/155.htm</link>
		<comments>http://wandsea.com/blog/155.htm#comments</comments>
		<pubDate>Sun, 13 Jul 2008 16:44:55 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[单词日记]]></category>
		<category><![CDATA[网络]]></category>

		<guid isPermaLink="false">昨天晚上寫那個<a href="http://wandsea.com/keywords/">PHP日記本</a>寫到了快1點，到最后還沒調試成功，早晨起來繼續寫，突然發現 require_once(‘數據庫調用地址)’; 這句代碼原來是應該寫在function函數里的，加進去立刻就好了。

現在實現的功能有讀取數據庫內的日期和單詞，每個月在最上方新增一張表格，自動添加側欄書簽，后臺頁面能夠手動添加單詞，更改某一天的單詞～

日記本還有很多地方需要完善的，比如刪除某一天的，而且日記本的登錄程序也沒有</guid>
		<description><![CDATA[昨天晚上寫那個PHP日記本寫到了快1點，到最后還沒調試成功，早晨起來繼續寫，突然發現 require_once(‘數據庫調用地址)’; 這句代碼原來是應該寫在function函數里的，加進去立刻就好了。
現在... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>昨天晚上寫那個<a href="http://wandsea.com/keywords/">PHP日記本</a>寫到了快1點，到最后還沒調試成功，早晨起來繼續寫，突然發現 require_once(‘數據庫調用地址)’; 這句代碼原來是應該寫在function函數里的，加進去立刻就好了。</p>
<p>現在實現的功能有讀取數據庫內的日期和單詞，每個月在最上方新增一張表格，自動添加側欄書簽，后臺頁面能夠手動添加單詞，更改某一天的單詞～</p>
<p>日記本還有很多地方需要完善的，比如刪除某一天的，而且日記本的登錄程序也沒有寫，現在的添加頁面地址就是一個密碼，哈哈，很偷懶啊～</p>
<p>不過Index頁面還是蠻漂亮的，Wordpress默認模板就是好啊，很簡潔，<a href="http://wandsea.com/contact/">留言簿的網頁</a>也是用這個模板的～</p>
<p>說到留言簿，現在的空間真的很好，fsock()能夠使用了，這樣發郵件就能夠完成了～</p>
<p>好吧，下面貼代碼，根據<a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/">知识共享署名-非商业性使用-相同方式共享</a>进行许可～哈哈~由于留言簿借鑒了好多網絡上的代碼，就不貼了～<span id="more-155"></span></p>
<blockquote><p>&lt;?php<br />
function h2($mo,$year)     /*這是輸出年月小標題的函數*/<br />
{<br />
$mo++;$mo--;   /*轉換為整型*/<br />
if ($mo&lt;=9){<br />
echo"&lt;h2&gt;";<br />
echo"&lt;a name='";echo $year; echo "0"; echo $mo; echo"'";<br />
echo "id='" ;echo $year; echo "0"; echo $mo; echo"'&gt;&lt;/a&gt;";<br />
echo $year; echo "-0"; echo $mo ;echo"&lt;/h2&gt;";<br />
}<br />
else<br />
{<br />
echo"&lt;h2&gt;";<br />
echo"&lt;a name='";echo $year; echo $mo; echo"'";<br />
echo "id='" ;echo $year;echo $mo; echo"'&gt;&lt;/a&gt;";<br />
echo $year; echo "-"; echo $mo ;echo"&lt;/h2&gt;";<br />
}<br />
}</p></blockquote>
<blockquote><p>function text($mos,$moe,$year)  /*這是輸出正文的函數,mos從幾月開始輸出moe從幾月結束*/<br />
{<br />
require_once("數據庫地址");    /*和wordpress一樣也需要一個Config.php自己更改*/<br />
$mos++;$mos--;<br />
$moe++;$moe--; /*轉換為整型*/<br />
for ($kk = $moe; $kk &gt;= $mos; $kk--) {    /*$kk為月份*/<br />
h2($kk,$year); /*打印副標題*/<br />
echo "&lt;div align='center'&gt;";<br />
echo " &lt;table width='100%' border='0' bgcolor='#F0F0F0'&gt;";<br />
$k =0;<br />
for ($ii = 1; $ii &lt;= 5; $ii++) {  /*構建表格*/<br />
echo "&lt;tr&gt;";<br />
for ($i = 1; $i &lt;= 7; $i++) {<br />
echo "&lt;td bgcolor='#FF9900'&gt;";echo "&lt;div align='center'&gt;";<br />
if (($k*7+$i)&lt;=31) echo $k*7+$i;<br />
echo "&lt;/div&gt;";echo "&lt;/td&gt;";<br />
}<br />
echo "&lt;/tr&gt;&lt;tr&gt;";<br />
for ($i = 1; $i &lt;= 7; $i++) {<br />
echo "&lt;td bgcolor='#99CCFF'&gt;";<br />
echo "&lt;div align='center'&gt;";<br />
if (($k*7+$i)&lt;=9) {<br />
if ($kk&lt;=9) $datea = $year.'0'.$kk.'0'.($k*7+$i); /*統一格式為8位,便于數據庫查詢*/<br />
if ($kk&gt;9) $datea = $year.$kk.'0'.($k*7+$i);<br />
$colname_getdairy = "-1";<br />
if (isset($datea)) {<br />
$colname_getdairy = (get_magic_quotes_gpc()) ? $datea : addslashes($datea);<br />
}<br />
mysql_select_db($database_dairy, $dairy);<br />
$query_getdairy = sprintf("SELECT * FROM dairy WHERE `date` = %s", $colname_getdairy);<br />
$getdairy = mysql_query($query_getdairy, $dairy) or die(mysql_error());<br />
$row_getdairy = mysql_fetch_assoc($getdairy);<br />
$totalRows_getdairy = mysql_num_rows($getdairy);<br />
echo $row_getdairy['note']; /*數據庫查詢,echo寫出*/</p>
<p>}<br />
if (($k*7+$i)&gt;9 &amp;&amp;($k*7+$i)&lt;=31) {         /*此處分兩種情況,</p></blockquote>
<blockquote><p>也是為了統一格式,寫完以后發覺其實可以把調用單獨寫,能少好多*/<br />
if ($kk&lt;=9) $datea = $year.'0'.$kk.($k*7+$i); /*統一格式為8位,便于數據庫查詢*/<br />
if ($kk&gt;9)    $datea = $year.$kk.($k*7+$i);<br />
$colname_getdairy = "-1";<br />
if (isset($datea)) {<br />
$colname_getdairy = (get_magic_quotes_gpc()) ? $datea : addslashes($datea);<br />
}<br />
mysql_select_db($database_dairy, $dairy);<br />
$query_getdairy = sprintf("SELECT * FROM dairy WHERE `date` = %s", $colname_getdairy);<br />
$getdairy = mysql_query($query_getdairy, $dairy) or die(mysql_error());<br />
$row_getdairy = mysql_fetch_assoc($getdairy);<br />
$totalRows_getdairy = mysql_num_rows($getdairy);<br />
echo $row_getdairy['note']; /*數據庫查詢,echo寫出*/</p></blockquote>
<blockquote><p>}<br />
echo "&lt;/div&gt; &lt;/td&gt;";<br />
}<br />
echo "&lt;tr/&gt;";   $k++;<br />
}<br />
echo  "&lt;/table&gt; &lt;/div&gt;";<br />
}<br />
}<br />
for ($kkk = (date(Y)-2008+1); $kkk &gt;=1 ; $kkk--)<br />
{<br />
if (($kkk+2007)==date(Y)&amp;&amp;(($kkk+2007)&lt;&gt;2008)){text (1,date(m),$kkk+2007);}<br />
elseif  (($kkk+2007)==date(Y)&amp;&amp;(($kkk+2007)==2008)) {text (7,date(m),$kkk+2007);}<br />
elseif (($kkk+2007)&lt;&gt;2008)  {text (1,12,$kkk+2007);}<br />
else {text (7,12,$kkk+2007);}; /*分情況調用以上函數*/<br />
}<br />
?&gt;</p></blockquote>
<p>至此輸出部分的函數寫完,下面是輸入和數據庫連接(太長了，就寫成txt打開吧):</p>
<p>require_once("數據庫地址"); 這個地址就是下面的數據庫連接這個文件的地址。</p>
<blockquote><p>&lt;?php<br />
# FileName="Connection_php_mysql.htm"<br />
# Type="MYSQL"<br />
# HTTP="true"<br />
$hostname_dairy = "localhost";<br />
$database_dairy = "数据表名";<br />
$username_dairy = "用户名";<br />
$password_dairy = "密码";<br />
$dairy = mysql_pconnect($hostname_dairy, $username_dairy, $password_dairy) or trigger_error(mysql_error(),E_USER_ERROR);<br />
?&gt;</p>
<p><a href="http://wandsea.com/keywords/input.txt">http://wandsea.com/keywords/input.txt</a></p></blockquote>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器 (4)</a></li>
<li><a href="http://wandsea.com/blog/437.htm" title="上海电信又开始强行插广告了&#8230;">上海电信又开始强行插广告了&#8230; (10)</a></li>
<li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本 (7)</a></li>
<li><a href="http://wandsea.com/blog/408.htm" title="随机闲聊网站-Omegle.com">随机闲聊网站-Omegle.com (25)</a></li>
<li><a href="http://wandsea.com/blog/406.htm" title="新鲜出炉的顶级域 .root">新鲜出炉的顶级域 .root (11)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/155.htm#comments" title="to the comments"><font color="red">加油！已经盖到1楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/155.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>另一种神奇的Whitespace语言</title>
		<link>http://wandsea.com/blog/65.htm</link>
		<comments>http://wandsea.com/blog/65.htm#comments</comments>
		<pubDate>Sat, 03 May 2008 06:24:36 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false"><p></p>  <p>Whitespace是由Durham大学的Wdwin Brady和Chris Morris发明的，于2003年4月1日发布（和愚人节有关？）。和大多数语言通常忽略空白字符不同，Whitespace解释器忽略一切非空白字符。空格、Tab和换行是仅有的语法元素。这就带来了一个有趣的事实：一个Whitespace程序可以完美地嵌入进一个文章之中。    <br />Whitespace是一种命令式堆栈型语言，程序运行在一个有一个栈（Stack）和一个堆（Heap）的虚拟机之上。编程者可以</guid>
		<description><![CDATA[
Whitespace是由Durham大学的Wdwin Brady和Chris Morris发明的，于2003年4月1日发布（和愚人节有关？）。和大多数语言通常忽略空白字符不同，Whitespace解释器忽略一切非空白字符。空格、Tab和换行是仅有... ]]></description>
			<content:encoded><![CDATA[<p class='fp'></p>
<p>Whitespace是由Durham大学的Wdwin Brady和Chris Morris发明的，于2003年4月1日发布（和愚人节有关？）。和大多数语言通常忽略空白字符不同，Whitespace解释器忽略一切非空白字符。空格、Tab和换行是仅有的语法元素。这就带来了一个有趣的事实：一个Whitespace程序可以完美地嵌入进一个文章之中。    <br />Whitespace是一种命令式堆栈型语言，程序运行在一个有一个栈（Stack）和一个堆（Heap）的虚拟机之上。编程者可以将任意大小的整数压入栈中（目前还没有实现对浮点数的操作）。堆常用作存储变量和数据结构的固定存储空间，用户可以直接访问。 数字和字母(ASCII)都用二进制表示，空格表示0，Tab表示1。你可以在<a href="http://compsoc.dur.ac.uk/whitespace/tutorial.php">这里</a>看到详细的教学。     <br />很多人会问，这个有什么用呢？     <br />确实没啥用。不过也确实很好玩。根据它的特点怎么也能编出一些不太靠谱儿的&#8220;用途&#8221;来。比如，和BrainFuck一样，这种语言要写注释就方便了，写的注释根本不需要标识，编译器直接跳过你写的文字信息。还有，我们完全可以在满篇空白的代码中插入一篇文章，从而在看起来完全无关的文章中隐藏一段代码。对于间谍工作来说这种语言帮助很大，因为它可以防止别人把代码打印出来拿走 -_-|||     <br />Whitespace已经被证明是图灵完备的。证明可以在主页的邮件列表中找到，其晦涩程度之大，目前还没有人对证明作出评论。下面是Hello World程序：</p>
<blockquote></blockquote>
<blockquote></blockquote>
<blockquote><pre>&#160;</pre>
<pre><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="666" alt="Whitespace" src="http://wandsea.com/blog/wp-content/uploads/2008/05/whitespace.jpg" width="348" border="0" />  </pre>
<pre>&#160;</pre>
</blockquote>
<pre>&#160;</pre>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/64.htm" title="神奇的BrainF**k语言">神奇的BrainF**k语言 (0)</a></li>
<li><a href="http://wandsea.com/blog/460.htm" title="关于C语言,推荐这么几本不错的书">关于C语言,推荐这么几本不错的书 (8)</a></li>
<li><a href="http://wandsea.com/blog/259.htm" title="Win32 Emacs 配置">Win32 Emacs 配置 (3)</a></li>
<li><a href="http://wandsea.com/blog/213.htm" title="Chtml-中國人自己的超文本編輯語言">Chtml-中國人自己的超文本編輯語言 (0)</a></li>
<li><a href="http://wandsea.com/blog/21.htm" title="一些神奇的函数图像">一些神奇的函数图像 (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/65.htm#comments" title="to the comments"><font color="red">加油！已经盖到0楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/65.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>神奇的BrainF**k语言</title>
		<link>http://wandsea.com/blog/64.htm</link>
		<comments>http://wandsea.com/blog/64.htm#comments</comments>
		<pubDate>Sat, 03 May 2008 05:58:11 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false"><p>先介绍下BrainF**k:</p>  <p>Brainf**k is the ungodly creation of Urban M&#252;ller, whose goal was apparently to create a Turing-complete language for which he could write the smallest compiler ever, for the Amiga OS 2.0. His compiler was 240 bytes in size.</guid>
		<description><![CDATA[先介绍下BrainF**k:
Brainf**k is the ungodly creation of Urban M&#252;ller, whose goal was apparently to create a Turing-complete language for which he could write the smallest compiler ever, for the Amiga OS 2.0. His compiler was 240 bytes in size. (... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>先介绍下BrainF**k:</p>
<p>Brainf**k is the ungodly creation of Urban M&#252;ller, whose goal was apparently to create a Turing-complete language for which he could write the smallest compiler ever, for the Amiga OS 2.0. His compiler was 240 bytes in size. (Though he improved upon this later -- he informed me at one point that he had managed to bring it under 200 bytes.)</p>
<p>BrainF**k 语言，是一种按照&#8220;Turing complete&#8221;思想设计的语言，它的主要设计思路是：用最小的概念实现一种&#8220;简单&#8221;的语言，BrainFuck 语言只有八种符号，所有的操作都由这八种符号的组合来完成。</p>
<p><tt>&gt; </tt>    <br />Increment the pointer.</p>
<p><tt>&lt; </tt>    <br />Decrement the pointer.</p>
<p><tt>+ </tt>    <br />Increment the byte at the pointer.</p>
<p><tt>- </tt>    <br />Decrement the byte at the pointer.</p>
<p><tt>. </tt>    <br />Output the byte at the pointer.</p>
<p><tt>, </tt>    <br />Input a byte and store it in the byte at the pointer.</p>
<p><tt>[ </tt>    <br />Jump forward past the matching <tt>]</tt> if the byte at the pointer is zero.</p>
<p><tt>] </tt>    <br />Jump backward to the matching <tt>[</tt> unless the byte at the pointer is zero.</p>
<p>&gt;&#160;&#160;&#160;&#160;&#160;&#160; 指针加一    <br />&lt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 指针减一     <br />+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 指针指向的字节的值加一     <br />- 指针指向的字节的值减一     <br />. 输出指针指向的单元内容(ASCII码)     <br />, 输入内容到指针指向的单元(ASCII码)     <br />[ 如果指针指向的单元值为零，向前跳转到对应的]指令的次一指令处     <br />] 如果指针指向的单元值不为零，向后跳转到对应的[指令的次一指令处</p>
<p>因为 BrainFuck 只有八种指令，并且没有关键字，也不允许自定义标识符，    <br />因此它的编译器实现起来非常简单，初学 C 语言不久的人都可以自己编出来，尽管在座的各位每人都可以自己编一个，不过为了引起大家的兴趣，我这里还是给出大家一个官方发布的版本：</p>
<blockquote><p>CODE:</p>
<p>#include &lt;stdio.h&gt;;      <br />int&#160;&#160; p, r, q;       <br />char a[5000], f[5000], b, o, *s=f;       <br />void interpret(char *c)       <br />{       <br />char *d;       <br />r++;       <br />while( *c ) {       <br />//if(strchr(&quot;&lt;&gt;;+-,.[]\n&quot;,*c))printf(&quot;%c&quot;,*c);       <br />switch(o=1,*c++) {       <br />case '&lt;': p--;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;       <br />case '&gt;;': p++;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;       <br />case '+': a[p]++;&#160;&#160;&#160;&#160; break;       <br />case '-': a[p]--;&#160;&#160;&#160;&#160; break;       <br />case '.': putchar(a[p]); fflush(stdout); break;       <br />case ',': a[p]=getchar();fflush(stdout); break;       <br />case '[':       <br />for( b=1,d=c; b &amp;&amp; *c; c++ )       <br />b+=*c=='[', b-=*c==']';       <br />if(!b) {       <br />c[-1]=0;       <br />while( a[p] )       <br />interpret(d);       <br />c[-1]=']';       <br />break;       <br />}       <br />case ']':       <br />puts(&quot;UNBALANCED BRACKETS&quot;), exit(0);       <br />case '#':       <br />if(q&gt;;2)       <br />printf(&quot;%2d %2d %2d %2d %2d %2d %2d %2d %2d %2d\n%*s\n&quot;,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; *a,a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],3*p+2,&quot;^&quot;);       <br />break;       <br />default: o=0;       <br />}       <br />if( p&lt;0 || p&gt;;100)       <br />puts(&quot;RANGE ERROR&quot;), exit(0);       <br />}       <br />r--;       <br />// chkabort();       <br />}       <br />main(int argc,char *argv[])       <br />{       <br />FILE *z;       <br />q=argc;       <br />if(z=fopen(argv[1],&quot;r&quot;)) {       <br />while( (b=getc(z))&gt;;0 )       <br />*s++=b;       <br />*s=0;       <br />interpret(f);       <br />}       <br />}</p>
</blockquote>
<p>&#160;</p>
<p>再贴点BF程序:</p>
<p>&#8220;Hello World&#8221;程序：</p>
<p>&gt;+++++++++[&lt;++++++++&gt;-]&lt;.&gt;+++++++[&lt;++++&gt;-]&lt;+.+++++++..+++.[-]&gt;+</p>
<p>+++++++[&lt;++++&gt;-]&lt;.&gt;+++++++++++[&lt;+++++&gt;-]&lt;.&gt;++++++++&lt;+++&gt;-]&lt;.+</p>
<p>++.------.--------.[-]&gt;++++++++[&lt;++++&gt;-]&lt;+.[-]++++++++++.</p>
<p>&#160;</p>
<p>==============头昏脑胀的分割线 ^-^================ </p>
<p>&#160;</p>
<p>怎样,这个语言很牛X吧?但更牛X的是.下面这个程序则允许用户输入一个数字然后程序将输出小于这个数字的所有质数。</p>
<p>&gt;++++++++[&lt;++++++++&gt;-]&lt;++++++++++++++++.[-]&gt;++++++++++[&lt;+++</p>
<p>+++++++&gt;-]&lt;+++++++++++++.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++</p>
<p>.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++++++.[-]&gt;++++++++++[&lt;++++</p>
<p>++++++&gt;-]&lt;+.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++++++++++++.[-]&gt;</p>
<p>+++++[&lt;+++++&gt;-]&lt;+++++++.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++++</p>
<p>++++++++++.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;++++++++++++.[-]&gt;+++</p>
<p>++[&lt;+++++&gt;-]&lt;+++++++.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++++++</p>
<p>++++++.[-]&gt;++++++++++[&lt;++++++++++&gt;-]&lt;+++++++++++.[-]&gt;+++++++[</p>
<p>&lt;+++++++&gt;-]&lt;+++++++++.[-]&gt;+++++[&lt;+++++&gt;-]&lt;+++++++.[-]+[-&gt;,----------</p>
<p>[&lt;+&gt;--------------------------------------&gt;[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&gt;&gt;&gt;+++++++++[&lt;</p>
<p>&lt;&lt;[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;[&lt;&lt;+&gt;&gt;-]&gt;&gt;-]&lt;&lt;&lt;[-]&lt;&lt;[&gt;+&lt;-]]&lt;]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&lt;&gt;+&lt;-</p>
<p>[&gt;+[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&gt;+&lt;--&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;+&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;[&gt;+&lt;-&lt;[&gt;&gt;&gt;+&gt;+&lt;&lt;&lt;</p>
<p>&lt;-]&gt;&gt;&gt;&gt;[&lt;&lt;&lt;&lt;+&gt;&gt;&gt;&gt;-]&lt;&lt;&lt;&gt;[&gt;&gt;+&gt;+&lt;&lt;&lt;-]&gt;&gt;&gt;[&lt;&lt;&lt;+&gt;&gt;&gt;-]&lt;&lt;&lt;&lt;&gt;&gt;&gt;[&gt;+&gt;+&lt;&lt;-]</p>
<p>&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&lt;&lt;[&gt;&gt;&gt;&gt;&gt;+&lt;&lt;&lt;[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;[&gt;&gt;[-]&lt;&lt;-]&gt;&gt;[&lt;&lt;&lt;&lt;[&gt;+&gt;+</p>
<p>&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&gt;&gt;&gt;-]&lt;&lt;&lt;-&lt;&lt;-]+&gt;&gt;[&lt;&lt;[-]&gt;&gt;-]&lt;&lt;&gt;[-]&lt;[&gt;&gt;&gt;&gt;&gt;&gt;[-]&lt;&lt;&lt;&lt;&lt;&lt;-]&lt;</p>
<p>&lt;&gt;&gt;[-]&gt;[-]&lt;&lt;&lt;]&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;[-&lt;&lt;&lt;&lt;&lt;&lt;&lt;[-]&lt;&lt;[&gt;&gt;+&gt;+&lt;&lt;&lt;-]&gt;&gt;&gt;[&lt;&lt;&lt;+&gt;&gt;&gt;-]&lt;&lt;&lt;&gt;&gt;</p>
<p>[&gt;+&lt;-]&gt;[[&gt;+&gt;+&lt;&lt;-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&gt;++++++++&lt;[&gt;&gt;&gt;+&lt;&lt;[&gt;+&gt;[-]&lt;&lt;-]&gt;[&lt;+&gt;-]&gt;[&lt;</p>
<p>&lt;++++++++++&gt;&gt;-]&lt;&lt;-&lt;-]+++++++++&gt;[&lt;-&gt;-]&lt;[&gt;+&lt;-]&lt;[&gt;+&lt;-]&lt;[&gt;+&lt;-]&gt;&gt;&gt;[&lt;&lt;&lt;</p>
<p>+&gt;&gt;&gt;-]&lt;&gt;+++++++++&lt;[&gt;&gt;&gt;+&lt;&lt;[&gt;+&gt;[-]&lt;&lt;-]&gt;[&lt;+&gt;-]&gt;[&lt;&lt;++++++++++&gt;&gt;&gt;+&lt;-</p>
<p>]&lt;&lt;-&lt;-]&gt;&gt;&gt;&gt;[&lt;&lt;&lt;&lt;+&gt;&gt;&gt;&gt;-]&lt;&lt;&lt;&lt;&gt;[-]&lt;&lt;+&gt;]&lt;[[&gt;+&lt;-]+++++++[&lt;+++++++&gt;-]&lt;-</p>
<p>&gt;&lt;.[-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;&lt;-]&gt;++++[&lt;++++++++&gt;-]&lt;.[-]&gt;&gt;&gt;&gt;&gt;&gt;&gt;]&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;[-]&lt;[-</p>
<p>]&lt;&lt;-]++++++++++.[-]</p>
<p>&#160;</p>
<p>不知看完之后你吐了没，如果没有，建议你吃过饭后再看一遍。-____-b</p>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/65.htm" title="另一种神奇的Whitespace语言">另一种神奇的Whitespace语言 (0)</a></li>
<li><a href="http://wandsea.com/blog/460.htm" title="关于C语言,推荐这么几本不错的书">关于C语言,推荐这么几本不错的书 (8)</a></li>
<li><a href="http://wandsea.com/blog/259.htm" title="Win32 Emacs 配置">Win32 Emacs 配置 (3)</a></li>
<li><a href="http://wandsea.com/blog/213.htm" title="Chtml-中國人自己的超文本編輯語言">Chtml-中國人自己的超文本編輯語言 (0)</a></li>
<li><a href="http://wandsea.com/blog/21.htm" title="一些神奇的函数图像">一些神奇的函数图像 (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/64.htm#comments" title="to the comments"><font color="red">加油！已经盖到0楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/64.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USACO Chapter1报告</title>
		<link>http://wandsea.com/blog/63.htm</link>
		<comments>http://wandsea.com/blog/63.htm#comments</comments>
		<pubDate>Sat, 03 May 2008 02:46:12 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Usaco]]></category>

		<guid isPermaLink="false"><p>Usaco第一章做完了，总结一下~ </p>  <p>&#160; </p>  <h4>Section 1.1.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=ride">PROB Your Ride Is Here</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=ride">[ANALYSIS]</a></h4>  <p>这道题就是考你会不</guid>
		<description><![CDATA[Usaco第一章做完了，总结一下~ 
&#160; 
Section 1.1.1 PROB Your Ride Is Here [ANALYSIS]
这道题就是考你会不会写程序啦，还有呢，就是 ord(c) 这个Function的运用了~ 
&#160; 
Section 1.1.2 PROB Greedy Gift Givers [ANALYSIS]
... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>Usaco第一章做完了，总结一下~ </p>
<p>&#160; </p>
<h4>Section 1.1.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=ride">PROB Your Ride Is Here</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=ride">[ANALYSIS]</a></h4>
<p>这道题就是考你会不会写程序啦，还有呢，就是 ord(c) 这个Function的运用了~ </p>
<p>&#160; </p>
<h4>Section 1.1.2 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=gift1">PROB Greedy Gift Givers</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=gift1">[ANALYSIS]</a></h4>
<p>这道题细心一点，名字对应好就不会错了~ </p>
<p>&#160; </p>
<h4>Section 1.1.3 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=friday">PROB Friday the Thirteenth</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=friday">[ANALYSIS]</a></h4>
<p>这一道题的关键就是：下一个月13号的星期数就等于(这个月13号的星期数＋这个月的天数MOD 7)MOD 7 </p>
<p>PS：我记星期天为0。 </p>
<p>&#160; </p>
<h4>Section 1.1.4 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=beads">PROB Broken Necklace</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=beads">[ANALYSIS]</a></h4>
<p>O（N）的算法。Dynamic Programming is good method for solving this problem in O(N). </p>
<p>If we consider two copies of the string we easy transform cyclic configuration of the necklace to linear. </p>
<p>Now we can compute for each breaking point how many beads of the same color can be collected on the left and on the right from the breaking point. I show how we can compute it only for the left side. </p>
<p>For right side it is analogical. Let r[p] and b[p] be the number of red / blue beads that can be collected, when necklace is broken in point p. If we know this and color of next bead (c) we can compute r[p+1] and b[p+1]. </p>
<p>r[0] = p[0] = 0 If c = 'r' then r[p+1] = r[p] + 1 and b[p+1] = 0 because the length of the blue beads is 0. </p>
<p>if c = 'b' then b[p+1] = b[p] + 1 and r[p+1] = 0if c = 'w' then both length of the red and length of blue beads canbe longer. so r[p+1] = r[p]+1 and b[p+1] = b[p] + 1. </p>
<p>The number of beads that can be collected in breaking point p is then </p>
<p>max(left[r[p]], left[b[p]]) + max(right[r[p]], right[b[p]]). </p>
<p>And themaximum from this value is answer for the problem. </p>
<p>PS：我是看了标程写出来的呃~做了好久，原来的烦死掉了，就重写了一个。先把珠子复制一遍~ </p>
<p>&#160; </p>
<h4>Section 1.2.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=milk2">PROB Milking Cows</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=milk2">[ANALYSIS]</a></h4>
<p>先按起始时间进行快速排序，然后按顺序判断时间段    <br />if t1[i]&lt;=r then     <br />r:=max(t2[i],r)     <br />t1[i]，t2[i]为每一位工人的起始结束时间。     <br />l、r为时间段的起始结束时间。     <br />每一个连续的时间段结束后。     <br />a1:=max(a1,r-l);     <br />a2:=max(a2,t1[i]-r);     <br />l:=t1[i];     <br />r:=t2[i];     <br />a1为最长的连续工作时间；     <br />a2为最长的空闲时间；     <br />最后再执行一次求最长的连续工作时间 a1:=max(a1,r-l);     <br />完成~ </p>
<p>&#160;</p>
<div id='extendedEntryBreak' name='extendedEntryBreak'></div>
<h4>Section 1.2.2 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=transform">PROB Transformations</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=transform">[ANALYSIS]</a></h4>
<p>这道题，好奇怪厄~主程序都一样，原来的就是提交不通过~呃~郁闷的~Procedure N4 为翻转Procedure N1 为顺时针90'最后再用 function bj 来判断两图案是否相同~ </p>
<blockquote><p>procedure N1(l:arr2; var m:arr2); </p>
<p>var i,j:integer; </p>
<p>begin </p>
<p>for i:=1 to n do </p>
<p>for j:=1 to n do </p>
<p>m[j,n-i+1]:=l[i,j]; </p>
<p>end; </p>
<p>function bj(a,b:arr2):boolean; </p>
<p>var i,j:integer; </p>
<p>begin </p>
<p>equal:= true; </p>
<p>for i:=1 to n do </p>
<p>for j:=1 to n do </p>
<p>if a[i,j] &lt;&gt; b[i,j] then begin </p>
<p>equal:=false; exit; </p>
<p>end; </p>
<p>end;</p>
</blockquote>
<p>&#160; </p>
<h4>Section 1.2.3 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=namenum">PROB Name That Number</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=namenum">[ANALYSIS]</a></h4>
<p>掌握好文件的读取写入操作，逐个读入字典中的人名，并转换成数字，与起始的数字比较，相同就输出，全部用字符串，不知道为什么我用int64和longint都不可以。厄~一开始想把数字转换成名字作但复杂度为O（3^N），太复杂，后来看了别人的报告，发觉用字典好~ </p>
<p>s:array['A'..'Z'] of char=('2','2','2','3','3','3','4','4','4','5','5','5', '6','6','6','7','7','7','7','8','8','8','9','9','9','9'); </p>
<p>&#160; </p>
<h4>Section 1.2.4 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=palsquare">PROB Palindromic Squares</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=palsquare">[ANALYSIS]</a></h4>
<p>最主要的是进制转换。Procedure ToB 然后倒转字符串若相等，即为回文数。输出。 </p>
<blockquote><p>procedure ToB (a:longint;var c:string); </p>
<p>var k,i:longint; </p>
<p>begin </p>
<p>k:=0; </p>
<p>c:=''; </p>
<p>repeat inc(k); </p>
<p>i:=a mod b; </p>
<p>a:=a div b; </p>
<p>c:=s[i]+c; </p>
<p>until a=0; </p>
<p>end;</p>
</blockquote>
<p>&#160; </p>
<h4>Section 1.2.5 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=dualpal">PROB Dual Palindromes</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=dualpal">[ANALYSIS]</a></h4>
<p>和上一道差不多 TOB +倒转字符串 轻松AC </p>
<p>&#160; </p>
<h4></h4>
<h4>Section 1.3.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=milk">PROB Mixing Milk</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=milk">[ANALYSIS]</a></h4>
<p>我先用快排Qsort把所有数据排序，每次选最小的卖牛奶的人把他&#8220;榨干&#8221;，求出钱数~ 贪心第一题 </p>
<p>&#160; </p>
<h4>Section 1.3.2 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=barn1">PROB Barn Repair</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=barn1">[ANALYSIS]</a></h4>
<p>~~~好汗的~已经是第三道关于牛的了呃~    <br />第一次数据太弱，程序完全错掉还AC3个，汗     <br />先读入全部数据，进行快排。     <br />然后把满牛棚之间的连续的空牛棚的数量存入数组，进行快排~     <br />舍去最大的M-1个数字~     <br />剩下的加上C即为最终解~ 还是贪心 </p>
<p>&#160; </p>
<h4>Section 1.3.3 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=calfflac">PROB Calf Flac</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=calfflac">[ANALYSIS]</a></h4>
<p>三个数组~a为原文c为a中的字母，转为大写存入~b为c中字母在a中对应的位置，最后输出时使用~ </p>
<p>&#160; </p>
<h4>Section 1.3.4 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=crypt1">PROB Prime Cryptarithm</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=crypt1">[ANALYSIS]</a></h4>
<p>厄~一开始没看清题目~以为最后输出的数为回文数~汗~USACO的题目太奇怪了~做到现在不是回文数就是COW呃~思维定势~别的就没有什么叻~枚举第一行，第二行的每一种可能性，使3，4，5行都满足条件~ </p>
<p>&#160; </p>
<h4>Section 1.4.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=packrec">PROB Packing Rectangles</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=packrec">[ANALYSIS]</a></h4>
<p>郁闷死了,从开学做到现在,不爽 ,Copy lhyxxh1 同学的, </p>
<p>这道题目数据规模很小，大可枚举4个矩形的摆放方式，然后再计算大矩形的边长。    <br />以下用width[1..4]表示矩形的长，height[1..4]表示矩形的宽。用w表示大矩形的长，h表示大矩形的宽：     <br />方式一：     <br />w = width[1] + width[2] + width[3] + width[4]     <br />h = ＭＡＸ｛height[1], height[2], height[3], height[4]｝     <br />方式二：     <br />w = ＭＡＸ｛width[1] + width[2] + width[3], width[4]｝     <br />h = ＭＡＸ｛height[1], height[2], height[3]｝ + height[4]     <br />方式三：     <br />w = ＭＡＸ｛width[1] + width[2], width[3]｝ + width[4]     <br />h = ＭＡＸ｛ＭＡＸ｛height[1], height[2]｝ + height[3], height[4]｝     <br />方式四：     <br />w = width[1] + width[2] + ＭＡＸ｛width[3], width[4]｝     <br />h = ＭＡＸ｛height[1], height[2], height[3] + height[4]｝     <br />方式五：     <br />同方式四。     <br />方式六：     <br />h = ＭＡＸ｛height[1] + height[3], height[2] + height[4]}     <br />w = ＭＡＸ: width[1] + width[2], 一般条件     <br />width[3], 一般条件     <br />width[4], 一般条件     <br />width[2] + width[3], 当height[1] &lt; height[2]时     <br />width[1] + width[4], 当height[1] &gt; height[2]时     <br />width[3] + width[4], 当height[1] + height[3] &gt; height[2]时     <br />注意以上是把矩形1放到左下，2放到右下，3放到右上，4放到左上为例的。 </p>
<p>&#160; </p>
<h4>Section 1.4.2 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=clocks">PROB The Clocks</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=clocks">[ANALYSIS]</a></h4>
<p>枚举所有方法 </p>
<p>还有一种Ox的 </p>
<blockquote><pre>program clocks;
const
INV : array[3..12] of byte =(1, 0, 0, 2, 0, 0, 3, 0, 0, 0);

var inp, out: text;
a, b, c, d, e, f, g, h, i: integer;
ax, bx, cx, dx, ex, fx, gx, hx, ix,l: integer;
t,an: array[1..9] of integer;
begin
assign (inp, 'clocks.in'); reset (inp);
readln(inp, ax, bx, cx);
readln(inp, dx, ex, fx);
readln(inp, gx, hx, ix);
a:=inv[ax]; b:=inv[bx]; c:=inv[cx]; d:=inv[dx];
e:=inv[ex]; f:=inv[fx]; g:=inv[gx]; h:=inv[hx];
i:=inv[ix];
t[1] := ( 8 + a + 2 * b + c + 2 * d +2 * e - f + g - h ) mod 4;
t[2] := ( a + b + c + d + e + f + 2 * g + 2 * i ) mod 4;
t[3] := ( 8 + a + 2 * b + c - d + 2 * e + 2 * f -h + i ) mod 4;
t[4] := ( a + b + 2 * c + d + e + g + h + 2 * i ) mod 4;
t[5] := ( 4 + a + 2 * b + c + 2 * d - e + 2 * f + g + 2 * h+ i ) </pre>
<pre>mod 4;
t[6] := ( 2 * a + b + c + e + f + 2 * g + h + i ) mod 4;
t[7] := ( 8 + a - b + 2 * d + 2 * e - f + g + 2 * h + i ) mod 4;
t[8] := ( 2 * a + 2 * c + d + e + f + g + h + i) mod 4;
t[9] := ( 8 - b + c - d + 2 * e + 2 * f + g + 2 * h+ i) mod 4;
assign(out, 'clocks.out'); rewrite(out);
for a := 1 to 9 do
for b := 1 to t[a] do Begin
inc(l);
an[l]:=a;
end;
for a:=1 to l-1 do
write(out,an[a],' ');
write(out,an[l]);
writeln(out); close(out)
end.</pre>
<pre>&#160;</pre>
</blockquote>
<h4>Section 1.4.3 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=ariprog">PROB Arithmetic Progressions</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=ariprog">[ANALYSIS]</a></h4>
<p>说实话，没看懂是怎么做的~ </p>
<p>&#160; </p>
<h4>Section 1.4.4 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=milk3">PROB Mother's Milk</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=milk3">[ANALYSIS]</a></h4>
<p>说实话，没看懂是怎么做的~ </p>
<p>&#160; </p>
<h4>Section 1.5.1 <a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=numtri">PROB Number Triangles</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=numtri">[ANALYSIS]</a></h4>
<p>dp[i,j]:=max(dp[i-1,j],dp[i-1,j-1])+tree[i,j]; </p>
<p>dp为到该节点的最大权值，tree为该点权值 </p>
<p>动规？ </p>
<p>&#160; </p>
<h4>Section 1.5.2<a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=pprime">PROB Prime Palindromes</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=pprime">[ANALYSIS]</a></h4>
<p>判断素数 </p>
<blockquote>
<p>function prime(z:longint):boolean;<br />
    <br />var </p>
<p>i:longint; </p>
<p>begin </p>
<p>begin </p>
<p>i:=2; </p>
<p>while (i*i&lt;=z) and (z mod i &lt;&gt;0) do inc(i); </p>
<p>if z mod i = 0 then prime:=false else prime:=true; </p>
<p>end; </p>
<p>end;</p>
</blockquote>
<p>还有就是符合条件的偶数位的数只有11（可以证明） 从三位数搜索吧（&lt;100 的只有 5 7 11） </p>
<p>&#160; </p>
<h4>Section 1.5.3<a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=sprime">PROB SuperPrime Rib</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=sprime">[ANALYSIS]</a></h4>
<blockquote>
<p>procedure sp(x,k:longint);<br />
    <br />var </p>
<p>i:longint; </p>
<p>begin </p>
<p>if k&lt;=n then </p>
<p>for i:=1 to 4 do begin </p>
<p>x:=x*10+y[i]; </p>
<p>if prime(x) then sp(x,k+1); </p>
<p>x:=(x-y[i]) div 10; </p>
<p>end </p>
<p>else </p>
<p>writeln(x); </p>
<p>end;</p>
</blockquote>
<p>x为当前数 k为当前数的长度 DFS 搜吧 </p>
<p>&#160; </p>
<h4>Section 1.5.4<a href="http://ace.delos.com/usacoprob2?a=U658EzgtBaJ&amp;S=checker">PROB Checker Challenge</a> <a href="http://ace.delos.com/usacoanal2?a=U658EzgtBaJ&amp;S=checker">[ANALYSIS]</a></h4>
<p>经典的8皇后问题，小于11的我能通过，大的就TLE了~ </p>
<p>&#160; </p>
<p>就这样吧~先更新到这里了~ </p>
<p>BY <a href="http://wandsea.com/">Wandsea</a> 转载请注明~ </p>
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/265.htm" title="USACO首页上的一段录音">USACO首页上的一段录音 (2)</a></li>
<li><a href="http://wandsea.com/blog/59.htm" title="Flood Fill 种子染色法">Flood Fill 种子染色法 (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/63.htm#comments" title="to the comments"><font color="red">加油！已经盖到0楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/63.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flood Fill 种子染色法</title>
		<link>http://wandsea.com/blog/59.htm</link>
		<comments>http://wandsea.com/blog/59.htm#comments</comments>
		<pubDate>Fri, 02 May 2008 11:10:22 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Usaco]]></category>
		<category><![CDATA[算法]]></category>

		<guid isPermaLink="false">Flood Fill 按原意应翻译成“水流式填充法”（如果我没译错），有些中文书籍上将它称作“种子染色法”，然而大部分的书籍（包括中文书籍）都直接引用其英文原名：Flood Fill。介于此，下文所有涉及到Flood Fill的都直接引用英文 ——译者）
<h4>样例： 相连的农场</h4>
Farmer John的农场被一次意外事故破坏了，有一些农场与其他的农场之间有道路相连，而有些道路却已被破坏。这使得Farmer John 无法了解到从一个农场能否到达另一个农场。你的任务就是帮助Farmer J</guid>
		<description><![CDATA[Flood Fill 按原意应翻译成“水流式填充法”（如果我没译错），有些中文书籍上将它称作“种子染色法”，然而大部分的书籍（包括中文书籍）都直接引用其英文原名：Flood Fill。介于此，下文... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>Flood Fill 按原意应翻译成“水流式填充法”（如果我没译错），有些中文书籍上将它称作“种子染色法”，然而大部分的书籍（包括中文书籍）都直接引用其英文原名：Flood Fill。介于此，下文所有涉及到Flood Fill的都直接引用英文 ——译者）</p>
<h4>样例： 相连的农场</h4>
<p>Farmer John的农场被一次意外事故破坏了，有一些农场与其他的农场之间有道路相连，而有些道路却已被破坏。这使得Farmer John 无法了解到从一个农场能否到达另一个农场。你的任务就是帮助Farmer John来了解哪些农场是连通的。</p>
<h4>给出：</h4>
<p>上题实际上就是要求寻找一张无向图的所有极大连通子图。</p>
<p>给出一张未知连通性的图，如下图：</p>
<p><a><img src="http://www.oiers.cn/usaco%20training/flood1.gif" alt="" /></a><br />
可知，该图的极大连通子图是：{1,4,8}， {2,5,6,7,9} 和 {3}。</p>
<h4>算法: Flood Fill</h4>
<p>Flood Fill 可以用深度优先搜索，广度优先搜索或广度优先扫描来实现。他的实现方式是寻找到一个未被标记的结点对它标记后扩展，将所有由它扩展出的结点标上与它相同的标号，然后再找另一个未被标号的 结点重复该过程。这样，标号相同的结点就属于同一个连通子图。</p>
<p>深搜：取一个结点，对其标记，然后标记它所有的邻结点。对它的每一个邻结点这么一直递归下去完成搜索。</p>
<p>广搜：与深搜不同的是，广搜把结点加入队列中。</p>
<p>广度扫描（不常见）：每个结点有两个值，一个用来记录它属于哪个连通子图（c），一个用来标记是否已经访问（v）。算法对每一个未访问而在某个连通子图当中的结点扫描，将其标记访问，然后把它的邻结点的（c）值改为当前结点的（c）值。</p>
<p>深搜最容易写，但它需要一个栈。搜索显式图没问题，而对于隐式图，栈可能就存不下了。</p>
<p>广搜稍微好一点，不过也存在问题。搜索大的图它的队列有可能存不下。深搜和广搜时间复杂度均为O(N+M)。其中，N为结点数，M为边数。</p>
<p>广度扫描需要的额外空间很少，或者可以说根本不要额外空间，但是它很慢。时间复杂度是O(N^2+M)。</p>
<p>（实际应用中，我们一般写的是DFS，因为快。空间不是问题，DFS可改用非递归的栈操作完成。但为了尊重原文，我们还是译出了广度扫描的全过程。——译者）</p>
<h4>广度扫描的伪代码</h4>
<p>代码中用了一个小技巧，因此无须额外空间。结点若未访问，将其归入连通子图（-2），就是代码里的component -2。这样无须额外空间来记录结点是否访问，请读者用心体会。<br />
<tt><span style="font-size: x-small;"><br />
# component(i) denotes the<br />
# component that node i is in<br />
1 function flood_fill(new_component) </span></tt></p>
<p><tt><span style="font-size: x-small;">2 do<br />
3    num_visited = 0<br />
4    for all nodes i<br />
5      if component(i) = -2<br />
6        num_visited = num_visited + 1<br />
7        component(i) = new_component<br />
8        for all neighbors j of node i<br />
9          if component(j) = nil<br />
10            component(j) = -2<br />
11 until num_visited = 0 </span></tt></p>
<p><tt><span style="font-size: x-small;">12 function find_components </span></tt></p>
<p><tt><span style="font-size: x-small;">13   num_components = 0<br />
14   for all nodes i<br />
15     component(node i) = nil<br />
16   for all nodes i<br />
17     if component(node i) is nil<br />
18       num_components =<br />
num_components + 1<br />
19       component(i) = -2<br />
20       flood_fill(component<br />
num_components)<br />
</span></tt></p>
<p>算法的时间复杂度是 O(<em>N <sup>2</sup></em>)，每个结点访问一次，每条边经过两次。</p>
<h4>实例</h4>
<p>考虑刚才的那张图：</p>
<p><a><img src="http://www.oiers.cn/usaco%20training/flood1.gif" alt="" /></a></p>
<p>开始时，所有的结点都没有访问。（下例中未访问被表示为 -2)</p>
<p>首先从结点1开始，结点1未访问，那么先处理结点1，将它归入连通子图1。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center"><strong>1</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
</tbody>
</table>
<p>标记完成后，对它进行第一步的扩展，由结点4和结点8与结点1连通，故它们被扩展出来。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>4</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center"><strong>8</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
</tbody>
</table>
<p>之后，先处理结点4，将它与结点1归入相同的连通子图。现在它没有可扩展的结点了（结点1已被扩展过）</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>4</strong></td>
<td style="text-align: center;"><strong>1</strong></td>
</tr>
<tr>
<td align="center"><strong>8</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
</tbody>
</table>
<p align="left">接着处理结点8。结果与结点4一样。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>8</strong></td>
<td align="center"><strong>1</strong></td>
</tr>
</tbody>
</table>
<p align="left">现在，所有与结点1连通的结点都已扩展，标号为1的连通子图产生了。那么我们将跳出扩展步骤，寻找下一个连通子图，标号为2。</p>
<p align="left">与上一步相同的顺序，找到结点2。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>2</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
</tbody>
</table>
<p align="left">扩展结点2，结点7与结点9出现。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>7</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>9</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
</tbody>
</table>
<p align="left">下一步，扩展结点7，结点5出现。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>5</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center"><strong>7</strong></td>
<td align="center"><strong>2</strong></td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center">-2</td>
</tr>
</tbody>
</table>
<p align="left">然后是结点9。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">-2</td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center"><strong>9</strong></td>
<td align="center"><strong>2</strong></td>
</tr>
</tbody>
</table>
<p align="left">扩展结点5。结点6出现。</p>
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"><strong>6</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center">2</td>
</tr>
</tbody>
</table>
<p align="left">很遗憾，结点6没有可供扩展的结点。至此连通子图2产生。</p>
<p align="left">
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"><strong>6</strong></td>
<td align="center"><strong>2</strong></td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center">2</td>
</tr>
</tbody>
</table>
<p align="left">之后寻找连通子图3，至此，仅有结点3未被扩展。</p>
<p align="left">
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center"><strong>3</strong></td>
<td align="center"><strong>-2</strong></td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">6</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center">2</td>
</tr>
</tbody>
</table>
<p align="left">结点3没有可供扩展的结点，这样，结点3就构成了仅有一个结点的连通子图3。</p>
<p align="left">
<table border="1">
<tbody>
<tr>
<td align="center">结点</td>
<td align="center">连通子图</td>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">3</td>
<td align="center">3</td>
</tr>
<tr>
<td align="center">4</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">5</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">6</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">7</td>
<td align="center">2</td>
</tr>
<tr>
<td align="center">8</td>
<td align="center">1</td>
</tr>
<tr>
<td align="center">9</td>
<td align="center">2</td>
</tr>
</tbody>
</table>
<p align="left">结点3处理结束后，整个图的所有9个结点就都被归入相应的3个连通子图。Flood Fill 结束。</p>
<h4>问题提示</h4>
<p align="left">这类问题一般很清晰，求解关于“连通”的问题会用到 Flood Fill。它也很经常用作某些算法的预处理。</p>
<h4>扩展与延伸</h4>
<p align="left">有向图的连通性比较复杂。</p>
<p align="left">同样的填充算法可以找出从一个结点能够到达的所有结点。每一层递归时，若一个结点未访问，就将其标记为已访问（表示他可以从源结点到达)，然后对它所有能到达且为访问的结点进行下一层递归。</p>
<p align="left">若要求出可以到达某个结点的所有结点，你可以对后向弧做相同的操作。</p>
<h4>例题</h4>
<h5>控制公司 [有删节, IOI 93]</h5>
<p align="left">已知一个带权有向图，权值在0-100之间。</p>
<p align="left">如果满足下列条件，那么结点A“拥有”结点B：</p>
<ul>
<li>
<p align="left">A = B</p>
</li>
<li>
<p align="left">从A到B有一条权值大于50的有向弧。</p>
</li>
<li>
<p align="left">存在一系列结点 <em>C <sub>1</sub></em> 到 <em>C <sub>k</sub></em> 满足 A 拥有 <em>C <sub>1</sub></em> 到 <em>C <sub>k</sub></em>, 每个节点都有一条弧到B，记作<em>x <sub>1</sub></em> <em>，x <sub>2 </sub></em>...<em>x <sub>k，</sub></em>并且 <em>x <sub>1</sub></em> + <em>x <sub>2</sub></em> + ... + <em>x <sub>k</sub></em> &gt; 50。</p>
</li>
</ul>
<p align="left">找出所有的（A，B）对，满足A拥有B。</p>
<p align="left">分析：这题可以用上面提到的“给出一个源，在有向图中找出它能够到达的结点”算法的改进版解决。要计算A拥有的结点，要对每个结点计算其“控股百分比”。 把它们全部设为0。现在，
<div align="right">
<h4>相关日志</h4>
<ul class="related_post">
<li><a href="http://wandsea.com/blog/265.htm" title="USACO首页上的一段录音">USACO首页上的一段录音 (2)</a></li>
<li><a href="http://wandsea.com/blog/63.htm" title="USACO Chapter1报告">USACO Chapter1报告 (0)</a></li>
</ul>
</div>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/59.htm#comments" title="to the comments"><font color="red">加油！已经盖到0楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/59.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
