﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-首页原创精华区</title><link>http://www.cppblog.com/</link><description>专注于C++技术</description><language>zh-cn</language><lastBuildDate>Mon, 22 Mar 2010 12:57:48 GMT</lastBuildDate><pubDate>Mon, 22 Mar 2010 12:57:48 GMT</pubDate><ttl>60</ttl><item><title>per-pixel lighting 纹理空间坐标基的计算方法 </title><link>http://www.cppblog.com/Leaf/archive/2010/03/22/110271.html</link><dc:creator>Leaf</dc:creator><author>Leaf</author><pubDate>Mon, 22 Mar 2010 02:19:00 GMT</pubDate><guid>http://www.cppblog.com/Leaf/archive/2010/03/22/110271.html</guid><wfw:comment>http://www.cppblog.com/Leaf/comments/110271.html</wfw:comment><comments>http://www.cppblog.com/Leaf/archive/2010/03/22/110271.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Leaf/comments/commentRss/110271.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Leaf/services/trackbacks/110271.html</trackback:ping><description><![CDATA[<span style="FONT-FAMILY: 方正姚体">文章来源：</span><a style="FONT-FAMILY: 方正姚体" href="http://www.freegames.com.cn/school/383/2007/27685.html">http://www.freegames.com.cn/school/383/2007/27685.html</a><span style="FONT-FAMILY: 方正姚体">Nemesis2k<br>per-pixel lighting 纹理空间坐标基的计算方法 <br><br>我知道的几种方法：<br><br>1. 对于参数化的表面，设其方程为 P = P (u, v)，其中 P 为向量，<br>三个分量分别为 x, y z。也可以表示为：<br>Px = Px (u ,v)<br>Py = Py (u ,v)<br>Pz = Pz (u ,v)<br>那在任意一个顶点<br>T = {dPx/du, dPy/du, dPz/du}<br>B = {dPx/dv, dPy/dv, dPz/dv}<br>N = T X B<br>然后把 T, B, N 归一化就行了。<br>这里的偏导数可以用差分计算。<br>这样计算出来的切空间是在每一个顶点的切空间。<br><br>2。对于由三角形面片组成的网格，在 MSDN 上的 Per-pixel lighting<br>文章里介绍了一种方法。<br>设三角形的三个顶点是 P0, P1, P2，其中每个顶点都有位置，法向量<br>和 2-D 纹理坐标。<br>Pi : {x, y, z}, {nx, ny, nz}, {s, t}<br>现在我们要计算在 P0 点的切空间。<br>这里要分辨两个切空间：<br>1）顶点上的切空间 <br>2）三角形面片上的切空间<br>两个切空间是相同的吗？我觉得是不同的。方法 2 和方法 3 计算出来的<br>实际上都是三角形面片的切空间，顶点的切空间还要通过平均顶点所在<br>各个三角形面片的切空间基向量来计算。（是这样的吗？高手指教一下！）<br><br>设三角形面片所在的切空间的基向量为 T, B, N，坐标原点在 P0。<br>那么三角形面片中的任意向量应该可以表示为：<br>Vec = x*T + y*B<br>因此，如果我们找到了两个向量 Vec1, Vec2 以及它们在 T, B 上的<br>分量，那么自然就可以解出 T, B 了。<br>令： <br>Vec1 = P1 - P0<br>Vec2 = P2 - P0<br>dS1 = P1.s - P0.s<br>dS2 = P2.s - P0.s<br>dT1 = P1.t - P0.t<br>dT2 = P2.t - p0.t<br>那么我们有<br>Vec1 = dS1*T + dT1*B (1)<br>Vec2 = dS2*T + dT2*B (2)<br>联立 (1), (2) 就可以解出<br>B*(dS2*dT1 - dS1*dT2) = (dS2*Vec1 - dS1*Vec2)<br>所以：<br>(dS2*dT1 - dS1*dT2) 是一个常数，反正我们之后要对 B 归一化，<br>可以不用管它。于是：<br>B = normalize(dS2*Vec1 - dS1*Vec2) 这就是 MSDN 里那篇文章里的方法。<br>B 可以通过解方程获得，但是 T 就不行了，因为这样解出来的 T 和<br>B 不一定垂直。怎么处理呢？<br>MSDN 中的方法是，利用顶点的 N 来求 T：<br>T = B X N<br>然后再求 N<br>N = T X B<br>但是这样可以吗？这里的 N 是顶点 P0 的 N，而不是三角形面片的 N。<br>是不是这样求出来的 T, N, B 恰好是顶点 P0 的切空间的坐标基，不需要<br>再平均了？（高手指教！）<br>我想的处理方法是这样的：<br>同样解出 T 来：<br>T = normalize(dT2*Vec1 - dT1*Vec2)<br>然后 N = T X B。这个 N 是三角形面片的 N。<br>然后 T = B X N。这样 T, N, B 构成正交基，而且是三角形面片的。<br>要计算 P0 顶点的切空间基，还需要平均多个面片。<br>这种方法到是比较复杂。<br><br>一个问题是，为什么有<br>Vec1 = dS1*T + dT1*B (1)<br>Vec2 = dS2*T + dT2*B (2)<br>这两个公式！<br>我想是因为在计算顶点的纹理坐标时，因为是从平面映射到平面，所以我们使用了<br>仿射变换：<br>s = as*x + bs*y + cs<br>t = as*x + bs*y + cs<br>反过来我们有<br>x = ax*s + bx*t + cx (3)<br>y = ay*s + by*t + cy (4)<br>z = az*s + bz*t + cz (5)<br>于是<br>Vec1.x = P1.x - P0.x = ax*(P1.s - P0.s) + bx*(P1.t - P0.t)<br>Vec1.y = P1.y - P0.y = ay*(P1.s - P0.s) + by*(P1.t - P0.t)<br>Vec1.z = P1.z - P0.z = az*(P1.s - P0.s) + bz*(P1.t - P0.t)<br>于是<br>Vec1 = {ax, ay, az}*dS1 + {bx, by, bz}*dT1<br>这和 (1) 已经很象了，那么 {ax, ay, az} 就是 T 吗？<br>答案是是的！事实上 (3), (4), (5) 就是三角形面片的参数表示，那么<br>T = {dx/ds, dy/ds, dz/ds} = {ax, ay, az}<br>B = {dx/dt, dy/dt, dz/dt} = {bx, by, bz}<br>也就是说，如果我们能直接把 ax, ay, az, bx, by, bz 求出来，T 和 B 就求出来了<br><br>（当然要把他们正交归一化）<br><br>3 nVidia 网站上的方法。<br>我们可以假设<br>x = ax*s + bx*t + cx <br>y = ay*s + by*t + cy <br>z = az*s + bz*t + cz <br>如何求解 (3) ？这里有 3 个未知数，那我们需要 3 个方程。<br>将 3 个顶点的属性 {x, y ,z}, {s, t} 带入，刚好有三个方程：<br>P0.x = ax*P0.s + bx*P0.t + cx (1)<br>P1.x = ax*P1.s + bx*P1.t + cx (2)<br>P2.x = ax*P2.s + bx*P2.t + cx (3)<br>解出来就得到 ax, bx, cx 了。<br>同理可得： ay, by, cy, az, bz, cz。<br>T = {ax, ay, az}<br>B = {bx, by, bz}<br>N = T X B<br>T = B X N<br>然后都归一化即可。<br><br>nVidia 网站上的方法呢，是建立三个平面方程<br>Ax*x + Bx*s + Cx*t + Dx = 0 (4)<br>Ay*y + By*s + Cy*t + Dy = 0 (5)<br>Az*z + Bz*s + Cz*t + Dz = 0 (6)<br><br>并且指出，三角形面片上的所有点的 (x, s, t) 都在 <br>方程 (4) 定义的平面中。那么<br>dx/ds = -Bx/Ax<br>dx/dt = -Cx/Ax<br><br>同理<br>dy/ds = -By/Ay<br>dy/dt = -Cy/Ay<br><br>dz/ds = -Bz/Az<br>dz/dt = -Cz/Az<br><br>那么这些 Ax, Ay, Az, Bx, By, Bz, Cx, Cy, Cz 怎么求呢？<br>容易知道，{Ax, Bx, Cx} 其实是平面的法向量，那么可以<br>选平面中的三个点，计算出两个向量，然后叉乘。<br><br>{Ax, Bx, Cx} = {P1.x - P0.x, P1.s - P0.s, P1.t - P0.t} X<br>{P2.x - P0.x, P2.s - P0.s, P2.t - P0.t} <br><br>这两种方法是等价的。 </span>
<img src ="http://www.cppblog.com/Leaf/aggbug/110271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Leaf/" target="_blank">Leaf</a> 2010-03-22 10:19 <a href="http://www.cppblog.com/Leaf/archive/2010/03/22/110271.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>好久没有更新了，写写最近这一周的个人日志，关于3d场景水体渲染的</title><link>http://www.cppblog.com/tonykee/archive/2010/03/21/110256.html</link><dc:creator>李侃</dc:creator><author>李侃</author><pubDate>Sun, 21 Mar 2010 14:34:00 GMT</pubDate><guid>http://www.cppblog.com/tonykee/archive/2010/03/21/110256.html</guid><wfw:comment>http://www.cppblog.com/tonykee/comments/110256.html</wfw:comment><comments>http://www.cppblog.com/tonykee/archive/2010/03/21/110256.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/tonykee/comments/commentRss/110256.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/tonykee/services/trackbacks/110256.html</trackback:ping><description><![CDATA[很长时间没有维护自己的博客了，真是不好意思，其实我这个博客最大的目的就是记录一些日记，对自己也是一个激励，这几个月工作很忙，个人引擎也渐渐段段搁置了一些时间，不过依然还在保持更新，最近这段时间加入了小植物的instancing，场景能根据chunk自动打包相同贴图的模型，而且支持子贴图（也就是一张大贴图中的一小部分作为植物的贴图，有点像小时候玩的画片一样），这样基本场景的所有地表植物，一两张贴图就足够了，效率非常高，另外就是好好把水重新构建了一下，水面本身的渲染就用了instancing技术，一次行渲染所有被裁减出来的水面块，水面用的两张NormalMap纹理动画，加入了水面的反射和折射（两个MRT)，反射多渲染了一次场景，加入了菲涅尔反射加强的光的反色饱和度，折射做了一次backbuffer的拷贝然后加入了normalmap纹理坐标的扰动，两个表面分别在水面的视椎和水底对称视椎投影到水面上进行渲染，总的来说效率还是过的去的，这个功能有一小部分参照了Nv的例子，好在周末两天就搞定了，并没有想象中那么困难，另外还有水底的光效（实际上只是个雾效）这是凭想象做的，有时间的话还要加上godlight以及水底地面对水面光影的反射效果，那样才更好看，现在这个样子不算特别好看，但也是马马虎虎了，好大堆参数还要单独做个水面板进行场景水体的参数配置，现在暂时没那么多时间了，不过还是老规矩，贴张图看看分别是水面和水底的<br><br><br><img border=0 alt="" src="http://www.cppblog.com/images/cppblog_com/tonykee/water.jpg" width=610 height=768>
<img src ="http://www.cppblog.com/tonykee/aggbug/110256.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/tonykee/" target="_blank">李侃</a> 2010-03-21 22:34 <a href="http://www.cppblog.com/tonykee/archive/2010/03/21/110256.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> 笨鸟先飞学编程系列之 指针</title><link>http://www.cppblog.com/besterChen/archive/2010/03/21/110253.html</link><dc:creator>bester</dc:creator><author>bester</author><pubDate>Sun, 21 Mar 2010 13:35:00 GMT</pubDate><guid>http://www.cppblog.com/besterChen/archive/2010/03/21/110253.html</guid><wfw:comment>http://www.cppblog.com/besterChen/comments/110253.html</wfw:comment><comments>http://www.cppblog.com/besterChen/archive/2010/03/21/110253.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/besterChen/comments/commentRss/110253.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/besterChen/services/trackbacks/110253.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 是啊，不可避免的，我们要学习指针了。关于指针的概念，我们已经在第一章节 理解程序中的数据 课题中大概的介绍过了，我想它并不是一个很难的概念，如果对指针没有任何一点概念的朋友可以试着百度一下，再看一下我们以前的章节。<br><br>       之所以把指针放到现在来讲，一方面是因为，到现在我们所学的知识，可以允许我把一个完整的指针及其相关的知识展现给大家而不需将一个知识点打乱到各个别的章节中；再一方面就是我们接下来的要学习的继承、多态等特性刚好需要这方面的的知识，省的我们再回头复习，当然，主要原因还是我没有信心能将这个专题写好。<br><br>是的，我们在管理内存，管理一些数据结构等等，很多情况都要使用指针，我们这个专题，就专门来讨论下指针的问题。<br><br>让我们再来回顾下，指针的一些概念。<br>&nbsp;&nbsp;<a href='http://www.cppblog.com/besterChen/archive/2010/03/21/110253.html'>阅读全文</a><img src ="http://www.cppblog.com/besterChen/aggbug/110253.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/besterChen/" target="_blank">bester</a> 2010-03-21 21:35 <a href="http://www.cppblog.com/besterChen/archive/2010/03/21/110253.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>盖莫游戏引擎的对象基类设计</title><link>http://www.cppblog.com/gaimor/archive/2010/03/21/110213.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Sun, 21 Mar 2010 08:46:00 GMT</pubDate><guid>http://www.cppblog.com/gaimor/archive/2010/03/21/110213.html</guid><wfw:comment>http://www.cppblog.com/gaimor/comments/110213.html</wfw:comment><comments>http://www.cppblog.com/gaimor/archive/2010/03/21/110213.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cppblog.com/gaimor/comments/commentRss/110213.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gaimor/services/trackbacks/110213.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 对于像游戏引擎的程序设计而言引擎的体系结构的重要性质是不言而喻的其中对象基类的设计也是很重要的主要的功能应该包含以下方面:1.对象类型识别2.对象的继承关系识别3.获取对象名字4.获取对象编号5.附带有智能指针6.当然必要的序列话作用也是必要的最基本的是对象引用计数类:&nbsp;1&nbsp;//////////////////////////////////////////////////...&nbsp;&nbsp;<a href='http://www.cppblog.com/gaimor/archive/2010/03/21/110213.html'>阅读全文</a><img src ="http://www.cppblog.com/gaimor/aggbug/110213.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gaimor/" target="_blank">ccsdu2009</a> 2010-03-21 16:46 <a href="http://www.cppblog.com/gaimor/archive/2010/03/21/110213.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Vczh Library++3.0之我的语法分析器和boost::spirit</title><link>http://www.cppblog.com/vczh/archive/2010/03/21/110209.html</link><dc:creator>陈梓瀚(vczh)</dc:creator><author>陈梓瀚(vczh)</author><pubDate>Sun, 21 Mar 2010 07:49:00 GMT</pubDate><guid>http://www.cppblog.com/vczh/archive/2010/03/21/110209.html</guid><wfw:comment>http://www.cppblog.com/vczh/comments/110209.html</wfw:comment><comments>http://www.cppblog.com/vczh/archive/2010/03/21/110209.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/vczh/comments/commentRss/110209.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/vczh/services/trackbacks/110209.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp; 其实<a style="TEXT-DECORATION: underline" href="http://vlpp.codeplex.com/" target=_blank>Vczh Library++3.0</a>提供的parser combinator并不能大量减少语法分析器的代码量，其实真正降低的是语法分析器的复杂程度。当你想比较快速的完成一个功能的时候，有两种代码量差不多的设计，一种实现起来比较难并且调试起来很惨，一种实现起来比较简单而且基本不用怎么调试，那相对来说肯定会选择后一种方法了。除非你纯粹是想获得锻炼。<br><br>&nbsp;&nbsp;&nbsp; 使用parser combinator开发语法分析器的时候，你可以直接往C++里面写EBNF语法，当然语法的具体形式因为受到C++语言本身的限制我做了一点点修改，譬如说A*和A+只好写成*A和+A，A B只好写成A + B、A&gt;&gt;B或者A&lt;&lt;B了。<a style="TEXT-DECORATION: underline" href="http://www.cppblog.com/lingjingqiu/" target=_blank>空明流产</a>跟我抱怨说boost::spirit编译速度奇慢（据说要一个多小时，不知道是不是他机器太烂&#8230;&#8230;）而且容易出现C1060 compiler is out of heap space的错误，相比之下我在用我自己开发的parser combinator的时候，我一个充满语法的cpp文件只需要一秒多一点（Thinkpad R61i, Vista Home Basic, 3G内存），而且不会出现C1060这种离谱的错误。至少从这个程度上来说，开发boost::spirit的人应该是有很大的C++洁癖症，才会把好好地一个parser combinator折腾成那个样子。<br><br>&nbsp;&nbsp;&nbsp; 我是用的文法模型是带类型修饰的文法，从文法的类型只能看出文法最终给你什么数据，而不是文法他本身是怎么写的。Vczh Library++2.0的parser combinator采用了后面一中的做法，据说boost::spirit也是这么做的，不过奇怪的是旧的parser combinator也没出现那两种错误，取而代之是VC++经常抱怨我一个表达式的类型签名超过了4000个字符（囧）。于是<a style="TEXT-DECORATION: underline" href="http://vlpp.codeplex.com/" target=_blank>Vczh Library++3.0</a>的parser combinator做了一点修改。<br><br>&nbsp;&nbsp;&nbsp; 假设你一条文法A的结果是node&lt;input, type&gt;，第二条文法B的结果是node&lt;input, string&gt;，那么A+B的结果就是node&lt;input, pair&lt;type, string&gt;&gt;。这是什么意义呢？我们看表达文法type name semicolon的意思，大概可以理解为他可以接受&#8220;int a;&#8221;的这种语句。首先由于C++的限制我们替换成type + name + semicolon，其次由于那个semicolon，也就是分号，其实仅仅是语法的要求而不是语法树的一个必须成分，因此改成type + name &lt;&lt; semicolon。这样的话，这个文法依旧会要求输入的字符串分别是一个类型、一个名字和一个分号，但是返回的结果就自动把分号给忽略掉了。那么我们如何表示一个同时包含type和name的类型呢？因为文法不可能替你创建一个struct，所以就定义了一个泛型的pair来表达。于是type + name &lt;&lt; semicolon的结果类型就是node&lt;input, pair&lt;type, string&gt;&gt;了。这里input代表输入的记号列表的类型。<br><br>&nbsp;&nbsp;&nbsp; 上面是新的parser combinator的做法，旧的parser combinator（据说也是boost::spirit的做法）的类型表示方法比较BT：当你有文法type : node&lt;input, type&gt;，string : node&lt;input, string&gt;和semicolon : node&lt;input, token&gt;的话，那么type + name &lt;&lt; semicolon的类型会变成：<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">1</span>&nbsp;<span style="COLOR: #000000">discard_right</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">input,&nbsp;sequence</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">input,&nbsp;node</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">input,&nbsp;type</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">,&nbsp;node</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">input,&nbsp;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">,&nbsp;node</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">input,&nbsp;token</span><span style="COLOR: #000000">&gt;&gt;</span></div>
&nbsp;&nbsp;&nbsp; 写成这样大概就可以理解什么是&#8220;文法他本身是怎么写的&#8221;了吧。<br><br>&nbsp;&nbsp;&nbsp; 旧的parser combinator的好处是C++为每一个文法生成了一个类型，虽然代码会膨胀一点但是执行过程会很快，只不过缺点比较多。第一个当然是类型太多VC++编译器会崩溃（C1060 compiler is out of heap space），第二个是编译时间过长，第三个是当你的文法比较长的时候，类型签名可能会超过VC++给你的限制，然后就会出现奇怪的问题。所以我在<a style="TEXT-DECORATION: underline" href="http://vlpp.codeplex.com/" target=_blank>Vczh Library++3.0</a>的parser combinator就是用了一个新的做法，也就是仅保留文法的结果类型，所以也就不得不引入虚函数了。因为一个文法node&lt;input, type&gt;有非常多种组合可能，在结构上没办法表现出来，所以必须使用虚函数。<br><br>&nbsp;&nbsp;&nbsp; 在听了<a style="TEXT-DECORATION: underline" href="http://www.cppblog.com/lingjingqiu/" target=_blank>空明流产</a>的抱怨之后，我去搜了一下使用boost::spirit的人的反应，好像都是遇到了那两个严重的问题。幸好我喜欢造车轮，不然的话也许也会深陷地狱了。不过boost::spirit还是提供了解决办法的，就是把你的长的文法拆开成短的。写过编译器的人都会知道，这么做的严重后果就是你的分析器变成一团乱麻，根本不知道自己在写什么，不仅不可能有我<a style="TEXT-DECORATION: underline" href="http://www.cppblog.com/vczh/archive/2010/03/07/109103.html" target=_blank>上一篇文章</a>描写的优美结果，更不可能把<a style="TEXT-DECORATION: underline" href="http://www.cppblog.com/vczh/archive/2010/02/24/108315.html" target=_blank>NativeX</a>的分析器写成下面这个样子了：<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;primitive&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;TRUE[ToTrue]&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;FALSE[ToFalse]<br></span><span style="COLOR: #008080">&nbsp;2</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;ACHAR[ToAChar]&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;WCHAR[ToWChar]<br></span><span style="COLOR: #008080">&nbsp;3</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;ASTRING[ToAString]&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;WSTRING[ToWString]<br></span><span style="COLOR: #008080">&nbsp;4</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;FLOAT[ToFloat]&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;DOUBLE[ToDouble]<br></span><span style="COLOR: #008080">&nbsp;5</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;NULL_VALUE[ToNull]<br></span><span style="COLOR: #008080">&nbsp;6</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;INTEGER[ToInteger]<br></span><span style="COLOR: #008080">&nbsp;7</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br></span><span style="COLOR: #008080">&nbsp;8</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reference&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;ID[ToReference];<br></span><span style="COLOR: #008080">&nbsp;9</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">10</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;primitive<br></span><span style="COLOR: #008080">11</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;reference<br></span><span style="COLOR: #008080">12</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;RESULT[ToResult]<br></span><span style="COLOR: #008080">13</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(CAST&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(LT&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;type&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;GT)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE))[ToCastExpression]<br></span><span style="COLOR: #008080">14</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br></span><span style="COLOR: #008080">15</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp0&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(<br></span><span style="COLOR: #008080">16</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(OPEN_ARRAY&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp0&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_ARRAY)<br></span><span style="COLOR: #008080">17</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;list(opt(exp&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(COMMA&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp)))[UpgradeArguments]&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE)<br></span><span style="COLOR: #008080">18</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;((DOT&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;POINTER)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;reference)<br></span><span style="COLOR: #008080">19</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(INCREASE&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;DECREASE)[UpgradePostfix]<br></span><span style="COLOR: #008080">20</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;ToPostUnary);<br></span><span style="COLOR: #008080">21</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;exp1&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;((INCREASE&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;DECREASE&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;BIT_AND&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;MUL&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;SUB&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;BIT_NOT&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;NOT)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp1)[ToPreUnary];<br></span><span style="COLOR: #008080">22</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp2&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((MUL&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;DIV&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;MOD)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp2),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">23</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp3&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((ADD&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;SUB)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp3),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">24</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp4&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((SHL&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;SHR)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp4),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">25</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp5&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((LT&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;GT&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;LE&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;GE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp5),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">26</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp6&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((EQ&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;NE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp6),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">27</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp7&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(BIT_AND&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp7),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">28</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp8&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(XOR&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp8),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">29</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp9&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(BIT_OR&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp9),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">30</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp10&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(AND&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp10),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">31</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp11&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(OR&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp11),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">32</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(exp12&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((OP_ASSIGN&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;ASSIGN)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;exp12),&nbsp;ToBinary);<br></span><span style="COLOR: #008080">33</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">34</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;primType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;(FUNCTION&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;list(opt(type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(COMMA&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;type)))&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE))[ToFunctionType]<br></span><span style="COLOR: #008080">35</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(PRIM_TYPE&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;ID)[ToNamedType]<br></span><span style="COLOR: #008080">36</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br></span><span style="COLOR: #008080">37</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;lrec(primType&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(MUL&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(OPEN_ARRAY&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;INTEGER&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_ARRAY)),&nbsp;ToDecoratedType);<br></span><span style="COLOR: #008080">38</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">39</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;statement&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;SEMICOLON[ToEmptyStat]<br></span><span style="COLOR: #008080">40</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(exp&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToExprStat]<br></span><span style="COLOR: #008080">41</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(VARIABLE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;opt(ASSIGN&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp)&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToVarStat]<br></span><span style="COLOR: #008080">42</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(IF&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;statement&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;opt(ELSE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;statement))[ToIfStat]<br></span><span style="COLOR: #008080">43</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(BREAK&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToBreakStat]<br></span><span style="COLOR: #008080">44</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(CONTINUE&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToContinueStat]<br></span><span style="COLOR: #008080">45</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(EXIT&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToReturnStat]<br></span><span style="COLOR: #008080">46</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(OPEN_STAT&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;list(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">statement)&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_STAT)[ToCompositeStat]<br></span><span style="COLOR: #008080">47</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(DO&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;statement&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(WHILE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON))[ToDoWhileStat]<br></span><span style="COLOR: #008080">48</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(LOOP&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;statement)[ToLoopStat]<br></span><span style="COLOR: #008080">49</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(WHILE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;statement&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;opt(WHEN&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON))[ToWhileStat]<br></span><span style="COLOR: #008080">50</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(FOR&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;list(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">statement)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(WHEN&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(WITH&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;list(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">statement))&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(DO&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;statement))[ToForStat]<br></span><span style="COLOR: #008080">51</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br></span><span style="COLOR: #008080">52</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">53</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;declaration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;(VARIABLE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;opt(ASSIGN&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;exp)&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToVarDecl]<br></span><span style="COLOR: #008080">54</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(TYPE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(ASSIGN&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;type)&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToTypedefDecl]<br></span><span style="COLOR: #008080">55</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(STRUCTURE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)[ToStructPreDecl]<br></span><span style="COLOR: #008080">56</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(STRUCTURE&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_STAT&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_STAT))[ToStructDecl]<br></span><span style="COLOR: #008080">57</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">&nbsp;(FUNCTION&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;(OPEN_BRACE&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;plist(opt((type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(COMMA&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;(type&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;ID))))&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;CLOSE_BRACE)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;statement)[ToFuncDecl]<br></span><span style="COLOR: #008080">58</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;;<br></span><span style="COLOR: #008080">59</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">60</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;((UNIT&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;ID&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON)&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;list(opt(USES&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;(ID&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(COMMA&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;ID))&nbsp;</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">&nbsp;SEMICOLON))&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;list(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">declaration))[ToUnit];</span></div>
<br>&nbsp;&nbsp;&nbsp; 啊，简直就跟EBNF没什么区别啊。 <br><br>&nbsp;&nbsp;&nbsp; 当前的进度可以在<a style="TEXT-DECORATION: underline" href="http://vlpp.codeplex.com/SourceControl/list/changesets" target=_blank>Vczh Library++3.0的页面</a>上看到。
<img src ="http://www.cppblog.com/vczh/aggbug/110209.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/vczh/" target="_blank">陈梓瀚(vczh)</a> 2010-03-21 15:49 <a href="http://www.cppblog.com/vczh/archive/2010/03/21/110209.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC 单步调试(StepInto)的一个小技巧</title><link>http://www.cppblog.com/clane/archive/2010/03/21/110206.html</link><dc:creator>clane</dc:creator><author>clane</author><pubDate>Sun, 21 Mar 2010 07:24:00 GMT</pubDate><guid>http://www.cppblog.com/clane/archive/2010/03/21/110206.html</guid><wfw:comment>http://www.cppblog.com/clane/comments/110206.html</wfw:comment><comments>http://www.cppblog.com/clane/archive/2010/03/21/110206.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/clane/comments/commentRss/110206.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/clane/services/trackbacks/110206.html</trackback:ping><description><![CDATA[&nbsp; 相对于Java之类的语言，缺少库一直是C++最为诟病的一个部分。STL、Boost等库的出现，在一定程度上弥补了这些缺憾。但这些库带来便利性的同时，也在调试代码时带来相当的不便。<br>&nbsp; 举个例子，看下面一段代码:<br>&nbsp; <br>
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">struct</span><span style="color: #000000;">&nbsp;FooObj<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;lower(</span><span style="color: #0000ff;">char</span><span style="color: #000000;">&nbsp;c){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c&nbsp;</span><span style="color: #000000;">|=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0x20</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;c;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>};<br><br></span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;s</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">Ok</span><span style="color: #000000;">"</span><span style="color: #000000;">;<br>shared_ptr</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">FooObj</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;ptr(</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;FooObj);<br>s[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">=</span><span style="color: #000000;">ptr</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">lower(s[</span><span style="color: #000000;">0</span><span style="color: #000000;">]);</span></div>
&nbsp; 在<span style="color: #000000;">s[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">=</span><span style="color: #000000;">ptr</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">lower(s[</span><span style="color: #000000;">0</span><span style="color: #000000;">]); 这一行下断点，想F11 StepInto进入lower函数调试，却不得不先进入std::basic_string的[],然后再进入boost::shared_ptr,最后才真正进入我们想要调试的lower函数。这是相当的烦人。<br>&nbsp; 虽然可以在调试时，使用右键菜单中的Step Into Specific直接进入lower函数，但也很繁琐。<br><img alt="" src="http://www.cppblog.com/images/cppblog_com/clane/1.png" height="106" width="585"><br><br>&nbsp; 我们可以在注册表中设置来避免vc 单步调试进入某些函数。具体的位置在:<br>
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\</span><span style="color: #000000;">9.0</span><span style="color: #000000;">\NativeDE\StepOver</span></div>
&nbsp; 其中vc2008是9.0,如果用的是其他版本的vc，则改成相应的版本号。在这个key下面新建两个字符串:<br>
<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">"</span><span style="color: #000000;">boost</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">boost\\:\\:.*=NoStepInto</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #000000;">"</span><span style="color: #000000;">std</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">std\\:\\:basic_string.*=NoStepInto</span><span style="color: #000000;">"</span></div>
&nbsp; 其中字符串值的含义:funcname=action，funcname是函数的名字，用正则表达式匹配, action则是执行的动作，可以是NoStepInto</span><code><span class="typ"><span style="font-family: sans-serif;">或者</span>StepInto</span></code><span style="color: #000000;">(当action是NoStepInto时，可以省略)。</span><span style="color: #000000;">NoStepInto</span><code><span class="typ"><span style="font-family: sans-serif;">，</span></span></code><span style="color: #000000;">表示当遇到这个名字的函数时，单步调试不会进入到函数内部。注意的是，函数必须是包含命名空间的原始名字。就是说，它并不能匹配typedef内容。string是std命名空间中的一个basic_string,那么字符串值必须是basic_string,而不能是string。<br>&nbsp; 这是我的</span><span style="color: #000000;"><span style="color: #000000;">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\</span><span style="color: #000000;">9.0</span><span style="color: #000000;">\NativeDE\StepOver下的内容:<br><img alt="" src="http://www.cppblog.com/images/cppblog_com/clane/2.png" height="249" width="602"><br></span></span><span style="color: #000000;"><br>&nbsp; Ok,现在完美了，在</span><span style="color: #000000;">s[</span><span style="color: #000000;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">=</span><span style="color: #000000;">ptr</span><span style="color: #000000;">-&gt;</span><span style="color: #000000;">lower(s[</span><span style="color: #000000;">0</span><span style="color: #000000;">])这一行，按F11，进入的是我们想进入的lower函数，而不是stl或者boost中的内容。另一方面当我们偶然想跟入库函数，也可以使用Step Into Specific来达到目的。<br></span><img src ="http://www.cppblog.com/clane/aggbug/110206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/clane/" target="_blank">clane</a> 2010-03-21 15:24 <a href="http://www.cppblog.com/clane/archive/2010/03/21/110206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在 QT 程序里使用Vista的 Glass 背景效果</title><link>http://www.cppblog.com/stevenyao/archive/2010/03/21/110198.html</link><dc:creator>姚冬</dc:creator><author>姚冬</author><pubDate>Sun, 21 Mar 2010 05:43:00 GMT</pubDate><guid>http://www.cppblog.com/stevenyao/archive/2010/03/21/110198.html</guid><wfw:comment>http://www.cppblog.com/stevenyao/comments/110198.html</wfw:comment><comments>http://www.cppblog.com/stevenyao/archive/2010/03/21/110198.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/stevenyao/comments/commentRss/110198.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/stevenyao/services/trackbacks/110198.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在 QT 程序里使用Vista的 Glass 背景效果&nbsp;&nbsp;<a href='http://www.cppblog.com/stevenyao/archive/2010/03/21/110198.html'>阅读全文</a><img src ="http://www.cppblog.com/stevenyao/aggbug/110198.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/stevenyao/" target="_blank">姚冬</a> 2010-03-21 13:43 <a href="http://www.cppblog.com/stevenyao/archive/2010/03/21/110198.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>线性代数挂了的找我童鞋朋友们！！- -</title><link>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110191.html</link><dc:creator>NARUTOACM</dc:creator><author>NARUTOACM</author><pubDate>Sat, 20 Mar 2010 17:14:00 GMT</pubDate><guid>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110191.html</guid><wfw:comment>http://www.cppblog.com/NARUTOACM/comments/110191.html</wfw:comment><comments>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110191.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/NARUTOACM/comments/commentRss/110191.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/NARUTOACM/services/trackbacks/110191.html</trackback:ping><description><![CDATA[<div style="LAYOUT-GRID:  15.6pt none" class=Section0>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt; FONT-SIZE: 36pt" class=p0><strong><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 18pt; mso-spacerun: 'yes'">童鞋们朋友们，线性代数挂了的找我啊！出售求矩阵的秩的程序，一元一个！！</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></strong></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">好了，言归正传。其实这是今天<font face="Times New Roman">(</font><font face=宋体>应该叫昨天了的说</font><font face="Times New Roman">)</font><font face=宋体>河北大学赛的其中一道题目：求矩阵的秩。题目就不抄了，就是求矩阵的秩。矩阵的行和列的上限为</font><font face="Times New Roman">10.</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">这道题不难，就是有点烦。要说思路，那就是直接硬搞，按线性代数书上的方法初等变换硬搞过去，这里只用行变换，省的到时麻烦一大堆。不考虑优化啥的，反正计算机别的不会，就会帮你算。最后统计下非零行总数就行了。源代码如下：</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">&nbsp;</p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cmath</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;eps&nbsp;1e-8</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;C,R;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;matrix[</span><span style="COLOR: #000000">12</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">12</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br><img id=Codehighlighter1_116_1021_Open_Image onclick="this.style.display='none'; Codehighlighter1_116_1021_Open_Text.style.display='none'; Codehighlighter1_116_1021_Closed_Image.style.display='inline'; Codehighlighter1_116_1021_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_116_1021_Closed_Image onclick="this.style.display='none'; Codehighlighter1_116_1021_Closed_Text.style.display='none'; Codehighlighter1_116_1021_Open_Image.style.display='inline'; Codehighlighter1_116_1021_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_116_1021_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_116_1021_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,j;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">C,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">R)</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">(C</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">R))<br><img id=Codehighlighter1_164_1008_Open_Image onclick="this.style.display='none'; Codehighlighter1_164_1008_Open_Text.style.display='none'; Codehighlighter1_164_1008_Closed_Image.style.display='inline'; Codehighlighter1_164_1008_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_164_1008_Closed_Image onclick="this.style.display='none'; Codehighlighter1_164_1008_Closed_Text.style.display='none'; Codehighlighter1_164_1008_Open_Image.style.display='inline'; Codehighlighter1_164_1008_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_164_1008_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_164_1008_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">C;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_188_245_Open_Image onclick="this.style.display='none'; Codehighlighter1_188_245_Open_Text.style.display='none'; Codehighlighter1_188_245_Closed_Image.style.display='inline'; Codehighlighter1_188_245_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_188_245_Closed_Image onclick="this.style.display='none'; Codehighlighter1_188_245_Closed_Text.style.display='none'; Codehighlighter1_188_245_Open_Image.style.display='inline'; Codehighlighter1_188_245_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_188_245_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_188_245_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">R;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%lf</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">matrix[i][j]);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;nc</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,nr</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_277_838_Open_Image onclick="this.style.display='none'; Codehighlighter1_277_838_Open_Text.style.display='none'; Codehighlighter1_277_838_Closed_Image.style.display='inline'; Codehighlighter1_277_838_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_277_838_Closed_Image onclick="this.style.display='none'; Codehighlighter1_277_838_Closed_Text.style.display='none'; Codehighlighter1_277_838_Open_Image.style.display='inline'; Codehighlighter1_277_838_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_277_838_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_277_838_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(nc</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">nr</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">R)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(fabs(matrix[nc][nr])</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">eps)<br><img id=Codehighlighter1_347_652_Open_Image onclick="this.style.display='none'; Codehighlighter1_347_652_Open_Text.style.display='none'; Codehighlighter1_347_652_Closed_Image.style.display='inline'; Codehighlighter1_347_652_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_347_652_Closed_Image onclick="this.style.display='none'; Codehighlighter1_347_652_Closed_Text.style.display='none'; Codehighlighter1_347_652_Open_Image.style.display='inline'; Codehighlighter1_347_652_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_347_652_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_347_652_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">nc</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">C;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_378_430_Open_Image onclick="this.style.display='none'; Codehighlighter1_378_430_Open_Text.style.display='none'; Codehighlighter1_378_430_Closed_Image.style.display='inline'; Codehighlighter1_378_430_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_378_430_Closed_Image onclick="this.style.display='none'; Codehighlighter1_378_430_Closed_Text.style.display='none'; Codehighlighter1_378_430_Open_Image.style.display='inline'; Codehighlighter1_378_430_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_378_430_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_378_430_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fabs(matrix[i][nr])</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">eps)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">C)<br><img id=Codehighlighter1_449_596_Open_Image onclick="this.style.display='none'; Codehighlighter1_449_596_Open_Text.style.display='none'; Codehighlighter1_449_596_Closed_Image.style.display='inline'; Codehighlighter1_449_596_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_449_596_Closed_Image onclick="this.style.display='none'; Codehighlighter1_449_596_Closed_Text.style.display='none'; Codehighlighter1_449_596_Open_Image.style.display='inline'; Codehighlighter1_449_596_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_449_596_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_449_596_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">R;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_479_578_Open_Image onclick="this.style.display='none'; Codehighlighter1_479_578_Open_Text.style.display='none'; Codehighlighter1_479_578_Closed_Image.style.display='inline'; Codehighlighter1_479_578_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_479_578_Closed_Image onclick="this.style.display='none'; Codehighlighter1_479_578_Closed_Text.style.display='none'; Codehighlighter1_479_578_Open_Image.style.display='inline'; Codehighlighter1_479_578_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_479_578_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_479_578_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;temp</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">matrix[nc][j];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matrix[nc][j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">matrix[i][j];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matrix[i][j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">temp;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nr</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(nc</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">nr</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">R)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(nc</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">nr</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">R)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">nc</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">C;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_710_820_Open_Image onclick="this.style.display='none'; Codehighlighter1_710_820_Open_Text.style.display='none'; Codehighlighter1_710_820_Closed_Image.style.display='inline'; Codehighlighter1_710_820_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_710_820_Closed_Image onclick="this.style.display='none'; Codehighlighter1_710_820_Closed_Text.style.display='none'; Codehighlighter1_710_820_Open_Image.style.display='inline'; Codehighlighter1_710_820_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_710_820_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_710_820_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">matrix[i][nr])</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">matrix[nc][nr];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">nr;j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">R;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matrix[i][j]</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">matrix[nc][j];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nc</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;nr</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">C;i</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_873_982_Open_Image onclick="this.style.display='none'; Codehighlighter1_873_982_Open_Text.style.display='none'; Codehighlighter1_873_982_Closed_Image.style.display='inline'; Codehighlighter1_873_982_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_873_982_Closed_Image onclick="this.style.display='none'; Codehighlighter1_873_982_Closed_Text.style.display='none'; Codehighlighter1_873_982_Open_Image.style.display='inline'; Codehighlighter1_873_982_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_873_982_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_873_982_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">R;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_899_947_Open_Image onclick="this.style.display='none'; Codehighlighter1_899_947_Open_Text.style.display='none'; Codehighlighter1_899_947_Closed_Image.style.display='inline'; Codehighlighter1_899_947_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_899_947_Closed_Image onclick="this.style.display='none'; Codehighlighter1_899_947_Closed_Text.style.display='none'; Codehighlighter1_899_947_Open_Image.style.display='inline'; Codehighlighter1_899_947_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_899_947_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_899_947_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(fabs(matrix[i][j])</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">eps)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">R)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,C</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">c);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span></div>
</span></div>
<!--endfragment-->
<img src ="http://www.cppblog.com/NARUTOACM/aggbug/110191.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/NARUTOACM/" target="_blank">NARUTOACM</a> 2010-03-21 01:14 <a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110191.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HDOJ2642解题报告</title><link>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110190.html</link><dc:creator>NARUTOACM</dc:creator><author>NARUTOACM</author><pubDate>Sat, 20 Mar 2010 16:56:00 GMT</pubDate><guid>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110190.html</guid><wfw:comment>http://www.cppblog.com/NARUTOACM/comments/110190.html</wfw:comment><comments>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110190.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/NARUTOACM/comments/commentRss/110190.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/NARUTOACM/services/trackbacks/110190.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: StarsTime&nbsp;Limit:&nbsp;5000/2000&nbsp;MS&nbsp;(Java/Others)&nbsp;&nbsp;&nbsp;&nbsp;Memory&nbsp;Limit:&nbsp;32768/65536&nbsp;K&nbsp;(Java/Others)Total&nbsp;Submission(s):&nbsp;117&nbsp;&nbsp;&nbs...&nbsp;&nbsp;<a href='http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110190.html'>阅读全文</a><img src ="http://www.cppblog.com/NARUTOACM/aggbug/110190.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/NARUTOACM/" target="_blank">NARUTOACM</a> 2010-03-21 00:56 <a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110190.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>POJ2352解题报告</title><link>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110188.html</link><dc:creator>NARUTOACM</dc:creator><author>NARUTOACM</author><pubDate>Sat, 20 Mar 2010 16:41:00 GMT</pubDate><guid>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110188.html</guid><wfw:comment>http://www.cppblog.com/NARUTOACM/comments/110188.html</wfw:comment><comments>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110188.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/NARUTOACM/comments/commentRss/110188.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/NARUTOACM/services/trackbacks/110188.html</trackback:ping><description><![CDATA[<p class=pst>Problem 2352 Stars<br><br>Description</p>
<div lang=en-US class=ptx>Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the levels of the stars. <br>
<center><img src="http://162.105.81.212/JudgeOnline/images/2352_1.jpg"></center><br>For example, look at the map shown on the figure above. Level of the star number 5 is equal to 3 (it's formed by three stars with a numbers 1, 2 and 4). And the levels of the stars numbered by 2 and 4 are 1. At this map there are only one star of the level 0, two stars of the level 1, one star of the level 2, and one star of the level 3. <br><br>You are to write a program that will count the amounts of the stars of each level on a given map.</div>
<p class=pst>Input</p>
<div lang=en-US class=ptx>The first line of the input file contains a number of stars N (1&lt;=N&lt;=15000). The following N lines describe coordinates of stars (two integers X and Y per line separated by a space, 0&lt;=X,Y&lt;=32000). There can be only one star at one point of the plane. Stars are listed in ascending order of Y coordinate. Stars with equal Y coordinates are listed in ascending order of X coordinate. <br></div>
<p class=pst>Output</p>
<div lang=en-US class=ptx>The output should contain N lines, one number per line. The first line contains amount of stars of the level 0, the second does amount of stars of the level 1 and so on, the last line contains amount of stars of the level N-1.</div>
<p class=pst>Sample Input</p>
<pre class=sio>5
1 1
5 1
7 1
3 3
5 5</pre>
<p class=pst>Sample Output</p>
<pre class=sio>1
2
1
1
0</pre>
<pre class=sio>
<h2 style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">解题思路</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p style="TEXT-ALIGN: left; MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">题意：</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="TEXT-ALIGN: left; MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: normal; mso-spacerun: 'yes'">题目不长，很容易理解，自己看<font face=Arial>-&nbsp;-</font></span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: normal; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">思路：</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'">让我们来看树状数组的第一个题。有关树状数组请看：</span><span><a href="http://hi.baidu.com/narutoacm/blog/item/fd514c0d9d58c7266059f3a9.html"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 10pt; TEXT-DECORATION: underline; mso-spacerun: 'yes'" class=15>http://hi.baidu.com/narutoacm/blog/item/fd514c0d9d58c7266059f3a9.html</span></a></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'">或者：</span><span><a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 10pt; TEXT-DECORATION: underline; mso-spacerun: 'yes'" class=15>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html</span></a></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'">题目告诉我们输入是按照<font face="Times New Roman">y</font><font face=宋体>的大小从小到大输入的，如果</font><font face="Times New Roman">y</font><font face=宋体>相等就按照</font><font face="Times New Roman">x</font><font face=宋体>大小从小到大输入，这无疑为我们提供了方便。当我们考虑某点时，显然我们可以只看在该点前面出现的点中的</font><font face="Times New Roman">x</font><font face=宋体>坐标，当点的</font><font face="Times New Roman">x</font><font face=宋体>坐标小于该点的</font><font face="Times New Roman">x</font><font face=宋体>坐标时，显然点被该点覆盖。于是我们可以用树状数组很快的统计出所有的点覆盖了多少点</font><font face="Times New Roman">(</font><font face=宋体>包括本身</font><font face="Times New Roman">)</font><font face=宋体>，即等级为多少。由于坐标下限是</font><font face="Times New Roman">0</font><font face=宋体>，所以插入和统计的时候都</font><font face="Times New Roman">+1.</font><font face=宋体>源代码如下：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<h2 style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">源程序</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">algorithm</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;N;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;C[</span><span style="COLOR: #000000">32005</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;X[</span><span style="COLOR: #000000">15005</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;p[</span><span style="COLOR: #000000">15005</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;lowbit(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x)<br><img id=Codehighlighter1_127_150_Open_Image onclick="this.style.display='none'; Codehighlighter1_127_150_Open_Text.style.display='none'; Codehighlighter1_127_150_Closed_Image.style.display='inline'; Codehighlighter1_127_150_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_127_150_Closed_Image onclick="this.style.display='none'; Codehighlighter1_127_150_Closed_Text.style.display='none'; Codehighlighter1_127_150_Open_Image.style.display='inline'; Codehighlighter1_127_150_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_127_150_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_127_150_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;x</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">(x</span><span style="COLOR: #000000">^</span><span style="COLOR: #000000">(x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">));<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;add(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;value)<br><img id=Codehighlighter1_178_234_Open_Image onclick="this.style.display='none'; Codehighlighter1_178_234_Open_Text.style.display='none'; Codehighlighter1_178_234_Closed_Image.style.display='inline'; Codehighlighter1_178_234_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_178_234_Closed_Image onclick="this.style.display='none'; Codehighlighter1_178_234_Closed_Text.style.display='none'; Codehighlighter1_178_234_Open_Image.style.display='inline'; Codehighlighter1_178_234_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_178_234_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_178_234_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">32001</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_198_232_Open_Image onclick="this.style.display='none'; Codehighlighter1_198_232_Open_Text.style.display='none'; Codehighlighter1_198_232_Closed_Image.style.display='inline'; Codehighlighter1_198_232_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_198_232_Closed_Image onclick="this.style.display='none'; Codehighlighter1_198_232_Closed_Text.style.display='none'; Codehighlighter1_198_232_Open_Image.style.display='inline'; Codehighlighter1_198_232_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_198_232_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_198_232_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C[i]</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">value;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">lowbit(i);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;SUM(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i)<br><img id=Codehighlighter1_251_325_Open_Image onclick="this.style.display='none'; Codehighlighter1_251_325_Open_Text.style.display='none'; Codehighlighter1_251_325_Closed_Image.style.display='inline'; Codehighlighter1_251_325_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_251_325_Closed_Image onclick="this.style.display='none'; Codehighlighter1_251_325_Closed_Text.style.display='none'; Codehighlighter1_251_325_Open_Image.style.display='inline'; Codehighlighter1_251_325_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_251_325_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_251_325_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;sum</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_278_310_Open_Image onclick="this.style.display='none'; Codehighlighter1_278_310_Open_Text.style.display='none'; Codehighlighter1_278_310_Closed_Image.style.display='inline'; Codehighlighter1_278_310_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_278_310_Closed_Image onclick="this.style.display='none'; Codehighlighter1_278_310_Closed_Text.style.display='none'; Codehighlighter1_278_310_Open_Image.style.display='inline'; Codehighlighter1_278_310_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_278_310_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_278_310_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">C[i];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i</span><span style="COLOR: #000000">-=</span><span style="COLOR: #000000">lowbit(i);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;sum;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br><img id=Codehighlighter1_338_604_Open_Image onclick="this.style.display='none'; Codehighlighter1_338_604_Open_Text.style.display='none'; Codehighlighter1_338_604_Closed_Image.style.display='inline'; Codehighlighter1_338_604_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_338_604_Closed_Image onclick="this.style.display='none'; Codehighlighter1_338_604_Closed_Text.style.display='none'; Codehighlighter1_338_604_Open_Image.style.display='inline'; Codehighlighter1_338_604_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_338_604_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_338_604_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,y;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">N)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">EOF)<br><img id=Codehighlighter1_387_591_Open_Image onclick="this.style.display='none'; Codehighlighter1_387_591_Open_Text.style.display='none'; Codehighlighter1_387_591_Closed_Image.style.display='inline'; Codehighlighter1_387_591_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_387_591_Closed_Image onclick="this.style.display='none'; Codehighlighter1_387_591_Closed_Text.style.display='none'; Codehighlighter1_387_591_Open_Image.style.display='inline'; Codehighlighter1_387_591_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_387_591_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_387_591_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">N;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_411_450_Open_Image onclick="this.style.display='none'; Codehighlighter1_411_450_Open_Text.style.display='none'; Codehighlighter1_411_450_Closed_Image.style.display='inline'; Codehighlighter1_411_450_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_411_450_Closed_Image onclick="this.style.display='none'; Codehighlighter1_411_450_Closed_Text.style.display='none'; Codehighlighter1_411_450_Open_Image.style.display='inline'; Codehighlighter1_411_450_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_411_450_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_411_450_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">x,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">y);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">x;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">N;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_474_519_Open_Image onclick="this.style.display='none'; Codehighlighter1_474_519_Open_Text.style.display='none'; Codehighlighter1_474_519_Closed_Image.style.display='inline'; Codehighlighter1_474_519_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_474_519_Closed_Image onclick="this.style.display='none'; Codehighlighter1_474_519_Closed_Text.style.display='none'; Codehighlighter1_474_519_Open_Image.style.display='inline'; Codehighlighter1_474_519_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_474_519_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_474_519_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add(X[i]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p[SUM(X[i]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">N;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,p[i]);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;memset(p,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(p));<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span></div>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"></span></p>
</pre>
<img src ="http://www.cppblog.com/NARUTOACM/aggbug/110188.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/NARUTOACM/" target="_blank">NARUTOACM</a> 2010-03-21 00:41 <a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110188.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>树状数组</title><link>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html</link><dc:creator>NARUTOACM</dc:creator><author>NARUTOACM</author><pubDate>Sat, 20 Mar 2010 16:27:00 GMT</pubDate><guid>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html</guid><wfw:comment>http://www.cppblog.com/NARUTOACM/comments/110186.html</wfw:comment><comments>http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/NARUTOACM/comments/commentRss/110186.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/NARUTOACM/services/trackbacks/110186.html</trackback:ping><description><![CDATA[<div style="LAYOUT-GRID:  15.6pt none" class=Section0>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">树状数组可以用来干嘛？树状数组可以用来快速求一个数组的和。。。。</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">当然这只是片面的，树状数组最大的好处就是支持处理一些动态的问题，它是一种高效的进行区间统计的数据结构。</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">它支持查询和修改操作，并且复杂度都是<font face="Times New Roman">log(n)</font><font face=宋体>级别的，可见树状数组的高效。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">看图说话<font face="Times New Roman">(</font><font face=宋体>摘自百度百科</font><font face="Times New Roman">)</font><font face=宋体>：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><img src="file:///C:/Users/ADMINI~1/AppData/Local/Temp/ksohtml/wps_clip_image-138.png" width=464 height=297><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">看懂了这个图就基本掌握了树状数组了。</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">来观察这个图：</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">令这棵树的结点编号为<font face="Times New Roman">C1</font><font face=宋体>，</font><font face="Times New Roman">C2...Cn</font><font face=宋体>。令每个结点的值为这棵树的值的总和，那么容易发现：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C1&nbsp;=&nbsp;A1</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C2&nbsp;=&nbsp;A1&nbsp;+&nbsp;A2</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C3&nbsp;=&nbsp;A3</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C4&nbsp;=&nbsp;A1&nbsp;+&nbsp;A2&nbsp;+&nbsp;A3&nbsp;+&nbsp;A4</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C5&nbsp;=&nbsp;A5</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C6&nbsp;=&nbsp;A5&nbsp;+&nbsp;A6</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C7&nbsp;=&nbsp;A7</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C8&nbsp;=&nbsp;A1&nbsp;+&nbsp;A2&nbsp;+&nbsp;A3&nbsp;+&nbsp;A4&nbsp;+&nbsp;A5&nbsp;+&nbsp;A6&nbsp;+&nbsp;A7&nbsp;+&nbsp;A8</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">...</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">C16&nbsp;=&nbsp;A1&nbsp;+&nbsp;A2&nbsp;+&nbsp;A3&nbsp;+&nbsp;A4&nbsp;+&nbsp;A5&nbsp;+&nbsp;A6&nbsp;+&nbsp;A7&nbsp;+&nbsp;A8&nbsp;+&nbsp;A9&nbsp;+&nbsp;A10&nbsp;+&nbsp;A11&nbsp;+&nbsp;A12&nbsp;+&nbsp;A13&nbsp;+&nbsp;A14&nbsp;+&nbsp;A15&nbsp;+&nbsp;A16</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">这里有一个有趣的性质：</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">设节点编号为<font face="Times New Roman">x</font><font face=宋体>，那么这个节点管辖的区间为</font><font face="Times New Roman">2^k</font><font face=宋体>（其中</font><font face="Times New Roman">k</font><font face=宋体>为</font><font face="Times New Roman">x</font><font face=宋体>二进制末尾</font><font face="Times New Roman">0</font><font face=宋体>的个数）个元素。因为这个区间最后一个元素必然为</font><font face="Times New Roman">Ax</font><font face=宋体>，</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">所以很明显：<font face="Times New Roman">Cn&nbsp;=&nbsp;A(n&nbsp;</font><font face=宋体>&#8211;&nbsp;</font><font face="Times New Roman">2^k&nbsp;+&nbsp;1)&nbsp;+&nbsp;...&nbsp;+&nbsp;An</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">算这个<font face="Times New Roman">2^k</font><font face=宋体>有一个快捷的办法，定义一个函数如下即可：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">int&nbsp;lowbit(int&nbsp;x){</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">return&nbsp;x&amp;(x^(x<font face=宋体>&#8211;</font><font face="Times New Roman">1));</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">}</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">当想要查询一个<font face="Times New Roman">SUM(n)</font><font face=宋体>时，可以依据如下算法即可：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">step1:<font face=宋体>令</font><font face="Times New Roman">sum&nbsp;=&nbsp;0</font><font face=宋体>，转第二步；</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">step2:<font face=宋体>假如</font><font face="Times New Roman">n&nbsp;&lt;=&nbsp;0</font><font face=宋体>，算法结束，返回</font><font face="Times New Roman">sum</font><font face=宋体>值，否则</font><font face="Times New Roman">sum&nbsp;=&nbsp;sum&nbsp;+&nbsp;Cn</font><font face=宋体>，转第三步；</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">step3:&nbsp;<font face=宋体>令</font><font face="Times New Roman">n&nbsp;=&nbsp;n&nbsp;</font><font face=宋体>&#8211;&nbsp;</font><font face="Times New Roman">lowbit(n)</font><font face=宋体>，转第二步。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">可以看出，这个算法就是将这一个个区间的和全部加起来，为什么是效率是<font face="Times New Roman">log(n)</font><font face=宋体>的呢？以下给出证明：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">n&nbsp;=&nbsp;n&nbsp;<font face=宋体>&#8211;&nbsp;</font><font face="Times New Roman">lowbit(n)</font><font face=宋体>这一步实际上等价于将</font><font face="Times New Roman">n</font><font face=宋体>的二进制的最后一个</font><font face="Times New Roman">1</font><font face=宋体>减去。而</font><font face="Times New Roman">n</font><font face=宋体>的二进制里最多有</font><font face="Times New Roman">log(n)</font><font face=宋体>个</font><font face="Times New Roman">1</font><font face=宋体>，所以查询效率是</font><font face="Times New Roman">log(n)</font><font face=宋体>的。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">那么修改呢，修改一个节点，必须修改其所有祖先，最坏情况下为修改第一个元素，最多有<font face="Times New Roman">log(n)</font><font face=宋体>的祖先。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">所以修改算法如下（给某个结点<font face="Times New Roman">i</font><font face=宋体>加上</font><font face="Times New Roman">x</font><font face=宋体>）：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">step1:&nbsp;<font face=宋体>当</font><font face="Times New Roman">i&nbsp;&gt;&nbsp;n</font><font face=宋体>时，算法结束，否则转第二步；</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">step2:&nbsp;Ci&nbsp;=&nbsp;Ci&nbsp;+&nbsp;x<font face=宋体>，&nbsp;</font><font face="Times New Roman">i&nbsp;=&nbsp;i&nbsp;+&nbsp;lowbit(i)</font><font face=宋体>转第一步。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">i&nbsp;=&nbsp;i&nbsp;+lowbit(i)<font face=宋体>这个过程实际上也只是一个把末尾</font><font face="Times New Roman">1</font><font face=宋体>补为</font><font face="Times New Roman">0</font><font face=宋体>的过程。</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'">对于数组求和来说树状数组简直太快了<font face="Times New Roman">!</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 10.5pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
</div>
<!--endfragment-->
<img src ="http://www.cppblog.com/NARUTOACM/aggbug/110186.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/NARUTOACM/" target="_blank">NARUTOACM</a> 2010-03-21 00:27 <a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/21/110186.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>POJ1026解题报告</title><link>http://www.cppblog.com/NARUTOACM/archive/2010/03/20/110183.html</link><dc:creator>NARUTOACM</dc:creator><author>NARUTOACM</author><pubDate>Sat, 20 Mar 2010 15:45:00 GMT</pubDate><guid>http://www.cppblog.com/NARUTOACM/archive/2010/03/20/110183.html</guid><wfw:comment>http://www.cppblog.com/NARUTOACM/comments/110183.html</wfw:comment><comments>http://www.cppblog.com/NARUTOACM/archive/2010/03/20/110183.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/NARUTOACM/comments/commentRss/110183.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/NARUTOACM/services/trackbacks/110183.html</trackback:ping><description><![CDATA[<p class=pst>Problem 1026 Cipher<br><br>Description</p>
<div lang=en-US class=ptx>Bob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decoding is based on secret keys. They chose the secret key at their last meeting in Philadelphia on February 16th, 1996. They chose as a secret key a sequence of n distinct integers, a1 ; . . .; an, greater than zero and less or equal to n. The encoding is based on the following principle. The message is written down below the key, so that characters in the message and numbers in the key are correspondingly aligned. Character in the message at the position i is written in the encoded message at the position ai, where ai is the corresponding number in the key. And then the encoded message is encoded in the same way. This process is repeated k times. After kth encoding they exchange their message. <br><br>The length of the message is always less or equal than n. If the message is shorter than n, then spaces are added to the end of the message to get the message with the length n. <br><br>Help Alice and Bob and write program which reads the key and then a sequence of pairs consisting of k and message to be encoded k times and produces a list of encoded messages. <br></div>
<p class=pst>Input</p>
<div lang=en-US class=ptx>The input file consists of several blocks. Each block has a number 0 &lt; n &lt;= 200 in the first line. The next line contains a sequence of n numbers pairwise distinct and each greater than zero and less or equal than n. Next lines contain integer number k and one message of ascii characters separated by one space. The lines are ended with eol, this eol does not belong to the message. The block ends with the separate line with the number 0. After the last block there is in separate line the number 0. </div>
<p class=pst>Output</p>
<div lang=en-US class=ptx>Output is divided into blocks corresponding to the input blocks. Each block contains the encoded input messages in the same order as in input file. Each encoded message in the output file has the lenght n. After each block there is one empty line. </div>
<p class=pst>Sample Input</p>
<pre class=sio>10
4 5 3 7 2 8 1 6 10 9
1 Hello Bob
1995 CERC
0
0
</pre>
<p class=pst>Sample Output</p>
<pre class=sio>BolHeol  b
C RCE</pre>
<pre class=sio>
<h2 style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">解题思路</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p style="TEXT-ALIGN: left; MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">题意：</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="TEXT-ALIGN: left; MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: normal; mso-spacerun: 'yes'">告诉你加密方式，让你按照那方式编码。</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: normal; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,0); FONT-SIZE: 12pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">思路：</span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'">模拟题，不过纯模拟的话有可能会<font face="Times New Roman">TLE</font><font face=宋体>，我们可以先算出周期</font><font face="Times New Roman">T</font><font face=宋体>，然后就可以去秒了。源代码如下：</font></span><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<h2 style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'">源程序</span><span style="FONT-FAMILY: '宋体'; COLOR: rgb(0,0,255); FONT-SIZE: 16pt; FONT-WEIGHT: bold; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0></p>
<div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">#include</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n,k;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;p[</span><span style="COLOR: #000000">205</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;s[</span><span style="COLOR: #000000">205</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;s2[</span><span style="COLOR: #000000">205</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;T[</span><span style="COLOR: #000000">205</span><span style="COLOR: #000000">];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()<br><img id=Codehighlighter1_111_677_Open_Image onclick="this.style.display='none'; Codehighlighter1_111_677_Open_Text.style.display='none'; Codehighlighter1_111_677_Closed_Image.style.display='inline'; Codehighlighter1_111_677_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_111_677_Closed_Image onclick="this.style.display='none'; Codehighlighter1_111_677_Closed_Text.style.display='none'; Codehighlighter1_111_677_Open_Image.style.display='inline'; Codehighlighter1_111_677_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_111_677_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_111_677_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,j;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">n)</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">n)<br><img id=Codehighlighter1_150_664_Open_Image onclick="this.style.display='none'; Codehighlighter1_150_664_Open_Text.style.display='none'; Codehighlighter1_150_664_Closed_Image.style.display='inline'; Codehighlighter1_150_664_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_150_664_Closed_Image onclick="this.style.display='none'; Codehighlighter1_150_664_Closed_Text.style.display='none'; Codehighlighter1_150_664_Open_Image.style.display='inline'; Codehighlighter1_150_664_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_150_664_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_150_664_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">p[i]);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_216_300_Open_Image onclick="this.style.display='none'; Codehighlighter1_216_300_Open_Text.style.display='none'; Codehighlighter1_216_300_Closed_Image.style.display='inline'; Codehighlighter1_216_300_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_216_300_Closed_Image onclick="this.style.display='none'; Codehighlighter1_216_300_Closed_Text.style.display='none'; Codehighlighter1_216_300_Open_Image.style.display='inline'; Codehighlighter1_216_300_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_216_300_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_216_300_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;c</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(p[j]</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">i)<br><img id=Codehighlighter1_259_285_Open_Image onclick="this.style.display='none'; Codehighlighter1_259_285_Open_Text.style.display='none'; Codehighlighter1_259_285_Closed_Image.style.display='inline'; Codehighlighter1_259_285_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_259_285_Closed_Image onclick="this.style.display='none'; Codehighlighter1_259_285_Closed_Text.style.display='none'; Codehighlighter1_259_285_Open_Image.style.display='inline'; Codehighlighter1_259_285_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_259_285_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_259_285_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">p[j];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">c;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">k)</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">k)<br><img id=Codehighlighter1_331_644_Open_Image onclick="this.style.display='none'; Codehighlighter1_331_644_Open_Text.style.display='none'; Codehighlighter1_331_644_Closed_Image.style.display='inline'; Codehighlighter1_331_644_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_331_644_Closed_Image onclick="this.style.display='none'; Codehighlighter1_331_644_Closed_Text.style.display='none'; Codehighlighter1_331_644_Open_Image.style.display='inline'; Codehighlighter1_331_644_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_331_644_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_331_644_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getchar();<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gets(s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;m</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;len</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strlen(s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s2[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">len;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_460_562_Open_Image onclick="this.style.display='none'; Codehighlighter1_460_562_Open_Text.style.display='none'; Codehighlighter1_460_562_Closed_Image.style.display='inline'; Codehighlighter1_460_562_Closed_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_460_562_Closed_Image onclick="this.style.display='none'; Codehighlighter1_460_562_Closed_Text.style.display='none'; Codehighlighter1_460_562_Open_Image.style.display='inline'; Codehighlighter1_460_562_Open_Text.style.display='inline';" align=top src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_460_562_Closed_Text><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_460_562_Open_Text><span style="COLOR: #000000">{<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">k</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">T[i];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(x</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">p[j];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s2[j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">s[i];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">m)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">j;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;=</span><span style="COLOR: #000000">m;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">s2[i];<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[m</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%s\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img align=top src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span></div>
<p style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt" class=p0><span style="FONT-FAMILY: '宋体'; FONT-SIZE: 12pt; mso-spacerun: 'yes'"></span><!--endfragment--></p>
</pre>
<img src ="http://www.cppblog.com/NARUTOACM/aggbug/110183.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/NARUTOACM/" target="_blank">NARUTOACM</a> 2010-03-20 23:45 <a href="http://www.cppblog.com/NARUTOACM/archive/2010/03/20/110183.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>2010年03月20日星期六.sgu256.cc dp </title><link>http://www.cppblog.com/schindlerlee/archive/2010/03/20/110161.html</link><dc:creator>schindlerlee</dc:creator><author>schindlerlee</author><pubDate>Sat, 20 Mar 2010 05:54:00 GMT</pubDate><guid>http://www.cppblog.com/schindlerlee/archive/2010/03/20/110161.html</guid><wfw:comment>http://www.cppblog.com/schindlerlee/comments/110161.html</wfw:comment><comments>http://www.cppblog.com/schindlerlee/archive/2010/03/20/110161.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/schindlerlee/comments/commentRss/110161.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/schindlerlee/services/trackbacks/110161.html</trackback:ping><description><![CDATA[2010年03月20日星期六.sgu256.cc dp <br />我看到这题的第一印象就是，这可能是个水题。但是我错了。<br />这个题一看就是个dp，于是我就写了个5层循环的dp，死活不知道怎么错了。<br />后来看到了scau的代码，发现递推式基本相同，不同的是他写的是记忆化搜索.<br />然后我也就写了个记忆话搜索，也过了。。<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 0, 0);">#include</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">iostream</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 0, 0);">#include</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">cstdio</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 0, 0);">#include</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">cstdlib</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);">#include</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">cstring</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 0, 0);">#include</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">algorithm</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">using</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">namespace</span><span style="color: rgb(0, 0, 0);"> std;<br /></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);">typedef </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> LL;<br /></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> maxint </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0x7fffffff</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> max64 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> 0x7fffffffffffffffll;<br /></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> Debug </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> M </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">228</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> N </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">13</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> inf </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1000000</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> dp[M][N][N][N][N], m, n, a[N], b[N];<br /></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> ckmin(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;</span><span style="color: rgb(0, 0, 0);">a, </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> b) { </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (a </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> b) { a </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> b; } }<br /></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> dfs(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> balloon,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> p0,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> p1,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> p2,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> p3)<br /></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (dp[balloon][p0][p1][p2][p3] </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> inf) {<br /></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> dp[balloon][p0][p1][p2][p3];<br /></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">  }<br /></span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (balloon </span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);"> m) {<br /></span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 0, 0);">  }<br /></span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;i </span><span style="color: rgb(0, 0, 0);">&lt;=</span><span style="color: rgb(0, 0, 0);"> n;i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br /></span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (b[i] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (p0 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i)) { </span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">; }<br /></span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (b[i] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (p0 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p1 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i)) { </span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">; }<br /></span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (b[i] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (p0 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p1 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p2 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i)) { </span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">; }<br /></span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 0, 0);">      </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (b[i] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> (p0 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p1 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p2 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> p3 </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> i)) { </span><span style="color: rgb(0, 0, 255);">continue</span><span style="color: rgb(0, 0, 0);">; }<br /></span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 0, 0);">      ckmin(dp [balloon][p0][p1][p2][p3] , dfs(balloon </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> a[i],i,p0,p1,p2) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 0, 0);">  }<br /></span><span style="color: rgb(0, 128, 128);">33</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (dp [balloon][p0][p1][p2][p3] </span><span style="color: rgb(0, 0, 0);">&gt;=</span><span style="color: rgb(0, 0, 0);"> inf) {<br /></span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);">      dp [balloon][p0][p1][p2][p3] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> dfs(balloon,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,p0,p1,p2) </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);">  }<br /></span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 0, 0);">  </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> dp [balloon][p0][p1][p2][p3];<br /></span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 128, 128);">38</span><span style="color: rgb(0, 0, 0);">//http://www.cppblog.com/schindlerlee<br /></span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> main()<br /></span><span style="color: rgb(0, 128, 128);">40</span> <span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">41</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i, j, k, p[</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">], tmp;<br /></span><span style="color: rgb(0, 128, 128);">42</span> <span style="color: rgb(0, 0, 0);">    memset(dp,</span><span style="color: rgb(0, 0, 0);">127</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">sizeof</span><span style="color: rgb(0, 0, 0);">(dp));<br /></span><span style="color: rgb(0, 128, 128);">43</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">printf("%d\n",dp[0][0][0][0][0]);</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 128, 128);">44</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">    scanf(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%d %d</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">&amp;</span><span style="color: rgb(0, 0, 0);">m, </span><span style="color: rgb(0, 0, 0);">&amp;</span><span style="color: rgb(0, 0, 0);">n);<br /></span><span style="color: rgb(0, 128, 128);">45</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);">&lt;=</span><span style="color: rgb(0, 0, 0);"> n; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br /></span><span style="color: rgb(0, 128, 128);">46</span> <span style="color: rgb(0, 0, 0);">        scanf(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%d %d</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, a </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> i, b </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> i);<br /></span><span style="color: rgb(0, 128, 128);">47</span> <span style="color: rgb(0, 0, 0);">    }<br /></span><span style="color: rgb(0, 128, 128);">48</span> <span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">49</span> <span style="color: rgb(0, 0, 0);">    printf(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%d\n</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,    dfs(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">));<br /></span><span style="color: rgb(0, 128, 128);">50</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">51</span> <span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 128, 128);">52</span> <span style="color: rgb(0, 0, 0);"></span></div><br /><img src ="http://www.cppblog.com/schindlerlee/aggbug/110161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/schindlerlee/" target="_blank">schindlerlee</a> 2010-03-20 13:54 <a href="http://www.cppblog.com/schindlerlee/archive/2010/03/20/110161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>应用程序正常初始化（0xc0000005）失败的问题</title><link>http://www.cppblog.com/gaimor/archive/2010/03/19/110128.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Fri, 19 Mar 2010 12:26:00 GMT</pubDate><guid>http://www.cppblog.com/gaimor/archive/2010/03/19/110128.html</guid><wfw:comment>http://www.cppblog.com/gaimor/comments/110128.html</wfw:comment><comments>http://www.cppblog.com/gaimor/archive/2010/03/19/110128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/gaimor/comments/commentRss/110128.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gaimor/services/trackbacks/110128.html</trackback:ping><description><![CDATA[应用程序正常初始化（0xc0000005）失败．请单击确定，终止应用程序是一个很常见的错误<br>常见的原因有指针初始化错误<br>不过因为是正常初始化失败所有错误原因可能源于全局的静态变量<br>对于具体的程序设计其原因还可能与涉及的其他动态库有关系O(&#8745;_&#8745;)O~<br><img src ="http://www.cppblog.com/gaimor/aggbug/110128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gaimor/" target="_blank">ccsdu2009</a> 2010-03-19 20:26 <a href="http://www.cppblog.com/gaimor/archive/2010/03/19/110128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Gpu terrain</title><link>http://www.cppblog.com/zzxhang/archive/2010/03/19/110103.html</link><dc:creator>清風</dc:creator><author>清風</author><pubDate>Fri, 19 Mar 2010 06:33:00 GMT</pubDate><guid>http://www.cppblog.com/zzxhang/archive/2010/03/19/110103.html</guid><wfw:comment>http://www.cppblog.com/zzxhang/comments/110103.html</wfw:comment><comments>http://www.cppblog.com/zzxhang/archive/2010/03/19/110103.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/zzxhang/comments/commentRss/110103.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/zzxhang/services/trackbacks/110103.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 最近想研究下GPU对地形渲染的性能优化,google到了Gpu gems2的一篇文章: <Terrain Rendering Using GPU-Based Geometry Clipmaps>,链接:http://research.microsoft.com/en-us/um/people/hoppe/gpugcm.pdf,扫了一遍,看懂了大概,把要点记于此:<br>&nbsp;&nbsp;<a href='http://www.cppblog.com/zzxhang/archive/2010/03/19/110103.html'>阅读全文</a><img src ="http://www.cppblog.com/zzxhang/aggbug/110103.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/zzxhang/" target="_blank">清風</a> 2010-03-19 14:33 <a href="http://www.cppblog.com/zzxhang/archive/2010/03/19/110103.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c++模板专题1 typedef template</title><link>http://www.cppblog.com/gaimor/archive/2010/03/19/110097.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Fri, 19 Mar 2010 04:55:00 GMT</pubDate><guid>http://www.cppblog.com/gaimor/archive/2010/03/19/110097.html</guid><wfw:comment>http://www.cppblog.com/gaimor/comments/110097.html</wfw:comment><comments>http://www.cppblog.com/gaimor/archive/2010/03/19/110097.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/gaimor/comments/commentRss/110097.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gaimor/services/trackbacks/110097.html</trackback:ping><description><![CDATA[<p>有时候我们需要typedef 一种模板<br>但是c++并没有直接的解决方案<br>也就是这样是不可行的.<br>typedef std::vector&lt;T&gt; myvector&lt;T&gt;;<br><br>间接的解决方式是:<br>(该代码源于盖莫游戏引擎代码)</p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">loki</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">flex</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">flex_string.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;2</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;flex_string</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;engine_string;<br></span><span style="COLOR: #008080">&nbsp;3</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">loki</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">yasli</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">yasli_vector.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">&nbsp;4</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;template</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;T</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">&nbsp;5</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000">&nbsp;vector_typedef<br></span><span style="COLOR: #008080">&nbsp;6</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">&nbsp;7</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;yasli::vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">T,std::allocator</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">T</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;type;<br></span><span style="COLOR: #008080">&nbsp;8</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">&nbsp;9</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;template</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;T</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">10</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000">&nbsp;list_typedef<br></span><span style="COLOR: #008080">11</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">12</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typedef&nbsp;yasli::vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">T,std::allocator</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">T</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">13</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;};&nbsp;&nbsp;</span></div>
<br>使用的时候是这样的<br>&nbsp;&nbsp;&nbsp;&nbsp; list_typedef&lt;int&gt;::type&nbsp; v;<br>&nbsp;&nbsp;&nbsp;&nbsp; list_typedef&lt;Vector3f&gt;::typedef veclist;<br>&nbsp;&nbsp;&nbsp;&nbsp; ...
<img src ="http://www.cppblog.com/gaimor/aggbug/110097.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gaimor/" target="_blank">ccsdu2009</a> 2010-03-19 12:55 <a href="http://www.cppblog.com/gaimor/archive/2010/03/19/110097.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>gcc之declaration does not declare anything解决方案</title><link>http://www.cppblog.com/gaimor/archive/2010/03/18/110035.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Thu, 18 Mar 2010 11:43:00 GMT</pubDate><guid>http://www.cppblog.com/gaimor/archive/2010/03/18/110035.html</guid><wfw:comment>http://www.cppblog.com/gaimor/comments/110035.html</wfw:comment><comments>http://www.cppblog.com/gaimor/archive/2010/03/18/110035.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/gaimor/comments/commentRss/110035.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gaimor/services/trackbacks/110035.html</trackback:ping><description><![CDATA[gcc的declaration does not declare anything&nbsp;<br>是一个很经典的问题<br>有以下解决方案<br>1.加上&nbsp; -fpermissive <br>2.修改相关头文件次序 <br>3.修改当前变量名<br>这不一定是程序的问题(O_O)？
<img src ="http://www.cppblog.com/gaimor/aggbug/110035.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gaimor/" target="_blank">ccsdu2009</a> 2010-03-18 19:43 <a href="http://www.cppblog.com/gaimor/archive/2010/03/18/110035.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WMS简介</title><link>http://www.cppblog.com/issayandfaye/archive/2010/03/18/110029.html</link><dc:creator>iSsay</dc:creator><author>iSsay</author><pubDate>Thu, 18 Mar 2010 09:36:00 GMT</pubDate><guid>http://www.cppblog.com/issayandfaye/archive/2010/03/18/110029.html</guid><wfw:comment>http://www.cppblog.com/issayandfaye/comments/110029.html</wfw:comment><comments>http://www.cppblog.com/issayandfaye/archive/2010/03/18/110029.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/issayandfaye/comments/commentRss/110029.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/issayandfaye/services/trackbacks/110029.html</trackback:ping><description><![CDATA[<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">目前市面上有多种基于互联网的在线地图服务，但是这些服务在互操作接口上缺少相应的行业规范，从而导致了</span><font face=Calibri>Web</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">地图服务的互操作的困难性。在</span><font face=Calibri>GIS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">行业日渐蓬勃的今天，为了解决这个问题，</span><font face=Calibri>GIS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">行业最主要的规范的制定者：</span><font face=Calibri>Open Geospatial Consortium</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">，开发了基于</span><font face=Calibri>WEB</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">地图服务的互操作规范——</span><font face=Calibri>Web Map Service</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Web Map Service</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">主要用于提供共享地图数据服务，能动态地响应客户程序的请求，将用户请求处理，转换成便于用户直观理解的地图图像、指定坐标点的要素信息、以及地图的功能说明信息。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Web Map Service</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">规范主要定义了三个结构的操作，</span><font face=Calibri>GetCapbilities</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">、</span><font face=Calibri>GetMap</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">、</span><font face=Calibri>GetFeatureInfo</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">。其中，前两个接口是必须实现的。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>---------------------------------------------------------------------------------------------------------------------------------</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GetCapbilities</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">接口用于查询</span><font face=Calibri>WMS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">服务范围的信息，包括支持的服务、支持的格式、空间坐标、地图列表、地图样式等。它主要的目的是使客户端在使用</span><font face=Calibri>GetMap</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">请求前可以对</span><font face=Calibri>WMS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">服务有一个大概的了解，从而设置正确的参数。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri>GetCapbilities</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">请求样例如下所示：</span><font face=Calibri><a href="http://xxx.com/geoserver/awms?version=x.x.x&amp;request">http://xxx.com/geoserver/awms?version=x.x.x&amp;request</a>= getcapbilities</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">。返回是一个</span><font face=Calibri>XML</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">文件，包括</span><font face=Calibri>Service</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">、</span><font face=Calibri>Capability</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">等部分，详细信息可以查看返回</span><font face=Calibri>XML</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">文件。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri>GetCapabilities</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">的具体请求参数如下表：</span></p>
<p><img src="http://www.cppblog.com/images/cppblog_com/issayandfaye/1.JPG" border=0></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>---------------------------------------------------------------------------------------------------------------------------------</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri>GetMap</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">接口用于向服务器请求一张地图图像数据。在它的请求中，可以控制地图的图层、图层绘制的样式、指定地图的坐标投影代码、控制请求地图的范围、像素宽度和高度、以及返回</span><span lang=ZH-CN><font face=Calibri> </font></span><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">地图图像的格式。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri>GetMap</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">的请求样例如下所示：</span><font face=Calibri>http://xxx.com/geoservice/wms?version=x.x.x&amp;request=getmap&amp;layers=topp:states&amp;styles=population&amp;SRS=EPSG:4326&amp;bbox=-125,24,-67,50&amp;width=400height=200&amp;format=image/png</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">如果参数设置错误，将返回一个</span><font face=Calibri>XML</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">文件来描述错误信息。如下所示：</span><font face=Calibri>&lt;ServiceExceptionReport vertion=&#8221;x.x.x&#8221;&gt;</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;ServiceException code=&#8221;&#8221;&gt;</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri><span style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>WIDTH and HEIGHT incorrectly specified</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;/ServiceException&gt;</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;/ServiceExceptionReport&gt;</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font face=Calibri>GetMap</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">的请求参数描述如表所示：</span></p>
<p>&nbsp;</p>
<p><img src="http://www.cppblog.com/images/cppblog_com/issayandfaye/2.JPG" border=0></p>
<p>&nbsp;</p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>---------------------------------------------------------------------------------------------------------------------------------</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GetFeatureInfo</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">它是一个可选操作，接口用于查询用户指定对象的属性信息。它的实现依赖于客户程序在</span><font face=Calibri>WMS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">服务器在先前返回的地图。只有用户指定了该地图的某一空间实体，并且该实体所在图层具有</span><font face=Calibri>queryable=&#8221;1&#8221;</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">属性才能支持该请求。如果一个</span><font face=Calibri>WMS</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">不支持该请求，则会返回一个</span><font face=Calibri>XML</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">文件描述错误信息。</span><span lang=ZH-CN><font face=Calibri> </font></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>GetFeatureInfo</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">的请求样例如下所示：</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>http://xxx.com/geoserver.wms?version=x.x.x&amp;request=getfeatureinfo&amp;layers=topp:states&amp;styles=population&amp;SRS=EPSG:4326&amp;bbox=-125,24,-67,50&amp;width=400height=200&amp;format=text/html&amp;query_layers=topp:states</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">。</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="mso-tab-count: 1"><font face=Calibri>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></span><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">此请求返回一个</span><font face=Calibri>HTML</font><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">文档来描述对象，如下所示：</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>Results for FeatureType &#8216;states&#8217;:</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=ZH-CN style="FONT-FAMILY: 宋体; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 宋体; mso-fareast-theme-font: minor-fareast; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin">——————————</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>The_geom<span style="mso-spacerun: yes">&nbsp; </span>= [GEOMETRY(Multipolyon) with 153 points]</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>STATE_NAME<span style="mso-spacerun: yes">&nbsp; </span>= Beijing</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>STATE_FIPS = 04</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>SUB_REGION = Mtn</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>STATE_ABBR = AZ</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>LAND_KM = 294333.462</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>WATER_KM = 942.772</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>PERSONS = 3665228.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>FAMILIES = 940106.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>HOUSHOLD = 1368843.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>MALE = 1810691.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>FEMALE = 1854537.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>WORKERS = 1358263.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>DRVALONE = 1178320.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>CARPOOL = 239083.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>PUBTRANS = 32856.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>EMPLOYED = 1603896.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>UNEMPLOY = 123902.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>SERVICE = 455896.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>MANUAL = 185109.0</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>P_MALE = 0.494</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>P_FEMALE = 0.506</font></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><font face=Calibri>SAMP_POP = 468178.0</font></p>
<div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 1pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-border-bottom-alt: solid windowtext .75pt">
<p class=MsoNormal style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; MARGIN: 0cm 0cm 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; mso-border-bottom-alt: solid windowtext .75pt; mso-padding-alt: 0cm 0cm 1.0pt 0cm"><o:p><font face=Calibri>&nbsp;</font></o:p></p>
</div>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><o:p><font face=Calibri>&nbsp;</font></o:p></p>
<img src ="http://www.cppblog.com/issayandfaye/aggbug/110029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/issayandfaye/" target="_blank">iSsay</a> 2010-03-18 17:36 <a href="http://www.cppblog.com/issayandfaye/archive/2010/03/18/110029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BMS(音乐游戏)文件结构解析</title><link>http://www.cppblog.com/CK985/archive/2010/03/18/110024.html</link><dc:creator>CK</dc:creator><author>CK</author><pubDate>Thu, 18 Mar 2010 08:57:00 GMT</pubDate><guid>http://www.cppblog.com/CK985/archive/2010/03/18/110024.html</guid><wfw:comment>http://www.cppblog.com/CK985/comments/110024.html</wfw:comment><comments>http://www.cppblog.com/CK985/archive/2010/03/18/110024.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/CK985/comments/commentRss/110024.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/CK985/services/trackbacks/110024.html</trackback:ping><description><![CDATA[<p>*开头表示注释，这行后面的字符串都忽略<br>空行*1<br>*---------------------- HEADER FIELD<br>空行*1<br>#PLAYER V-整数<br>{游戏模式，1-单人，2-双人单边，3-单人双边，4-9Key，5-13Key}<br>无空行<br>#GENRE V-字符串<br>{曲风}<br>无空行<br>#TITLE V-字符串<br>{游戏标题}<br>无空行<br>#ARTIST V-字符串<br>{Noter}<br>无空行<br>#BPM V-实数<br>{BPM标识}<br>无空行<br>#PLAYLEVEL V-整数<br>{星级}<br>无空行<br>#RANK V-整数<br>{难度等级，3-Easy，2-Normal，1-Hard，0-Very Hard}<br>无空行<br>#TOTAL V-整数<br>{音符总数}<br>无空行<br>#VOLWAV V-整数<br>{意义暂时不明}<br>无空行<br>#STAGEFILE S-字符串<br>{预览图文件路径(直接跟文件名，即相对路径，跟BMS文件在同一文件夹)}<br>空行*1<br>{块<br>#WAVXX S-字符串</p>
<p>XX-2位16进制数，标志此WAV项编号<br>S-文件路径(相对路径)<br>}<br>空行*1<br>{块<br>#BMPXX S-字符串</p>
<p>XX-2位16进制数，标识此图资源编号<br>S-文件路径(相对路径)<br>注：BPM00代表游戏时的LOGO<br>}<br>空行*2（其实我猜中间还有个东西，不过没发现）<br>{块<br>#BPMXX V-实数</p>
<p>XX-2位16进制数，标识此BPM标签编号<br>V-此标签代表的BPM数值<br>}<br>空行*1<br>{块<br>#STOPXX V-实数</p>
<p>XX-2位16进制数，标识此STOP标签编号<br>}<br>空行*1<br>{块<br>S-字符串</p>
<p>Expand信息，貌似没用<br>}<br>空行*3<br>*---------------------- MAIN DATA FIELD<br>空行*1<br>{块<br>&nbsp; {块<br>&nbsp; #PPPTT:V<br>&nbsp; PPP=小节数</p>
<p>&nbsp; TT=记录类型<br>&nbsp;&nbsp;&nbsp;&nbsp; 01=WAV资源放置编号，每一列分一行<br>&nbsp;&nbsp;&nbsp;&nbsp; 03=16进制数值BPM（当设置的BPM值小于256而且不是小数时）<br>&nbsp;&nbsp;&nbsp;&nbsp; 04=BGA<br>&nbsp;&nbsp;&nbsp;&nbsp; 06=POOR<br>&nbsp;&nbsp;&nbsp;&nbsp; 07=LAYER<br>&nbsp;&nbsp;&nbsp;&nbsp; 08=自定义BPM数值编号<br>&nbsp;&nbsp;&nbsp;&nbsp; 09=STOP，作用不明<br>&nbsp;&nbsp;&nbsp;&nbsp; 11~16+18~19=8个按键，18为最左，11~16一次向右，19为按键最后一列，数值代表</p>
<p>Key音WAV编号<br>&nbsp;&nbsp;&nbsp;&nbsp; 51~56+58~59=8个按键位置，对应长条的起始和终止点，跟上面的一样</p>
<p><br>&nbsp; V:设字符串长度为A，则记录值将这个小节分为A/2个时间点，每个记录值以2位16进制数</p>
<p>存储，若为00则表示忽略<br>&nbsp; }<br>每小节空行*1<br>}<br>文件结束<br></p>
<img src ="http://www.cppblog.com/CK985/aggbug/110024.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/CK985/" target="_blank">CK</a> 2010-03-18 16:57 <a href="http://www.cppblog.com/CK985/archive/2010/03/18/110024.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>［征集］如果百度无线搜索计划产出新产品，你最希望是什么？</title><link>http://www.cppblog.com/cxl82116/archive/2010/03/18/110015.html</link><dc:creator>常兴龙</dc:creator><author>常兴龙</author><pubDate>Thu, 18 Mar 2010 08:08:00 GMT</pubDate><guid>http://www.cppblog.com/cxl82116/archive/2010/03/18/110015.html</guid><wfw:comment>http://www.cppblog.com/cxl82116/comments/110015.html</wfw:comment><comments>http://www.cppblog.com/cxl82116/archive/2010/03/18/110015.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cppblog.com/cxl82116/comments/commentRss/110015.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cxl82116/services/trackbacks/110015.html</trackback:ping><description><![CDATA[如果百度无线搜索计划产出新产品，你最希望是什么？<br><br>留下脚印，发表你的创意。<img src ="http://www.cppblog.com/cxl82116/aggbug/110015.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cxl82116/" target="_blank">常兴龙</a> 2010-03-18 16:08 <a href="http://www.cppblog.com/cxl82116/archive/2010/03/18/110015.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>发布盖莫音频引擎1.1版本(第二次发布)</title><link>http://www.cppblog.com/gaimor/archive/2010/03/18/109960.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Thu, 18 Mar 2010 01:57:00 GMT</pubDate><guid>http://www.cppblog.com/gaimor/archive/2010/03/18/109960.html</guid><wfw:comment>http://www.cppblog.com/gaimor/comments/109960.html</wfw:comment><comments>http://www.cppblog.com/gaimor/archive/2010/03/18/109960.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/gaimor/comments/commentRss/109960.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/gaimor/services/trackbacks/109960.html</trackback:ping><description><![CDATA[发布盖莫音频引擎1.1版本(第二次发布)<br>盖莫音频引擎1.1版本是在盖莫音频引擎1.0基础上发展而来<br>支持 ogg,wav,mp33种常见音频格式<br>使用多线程,流式播放音频<br>支持低通,次音效等几种音效(没有支持更多音效和xram的原因是机器声卡能力有限)<br>真3d音效<br>可使用于 linux,win2,xbox,苹果机等平台<br>可替代fmod音频引擎<br>可在以下几个站点下载它:<br><a href="http://download.csdn.net/source/2137526">csdn:http://download.csdn.net/source/2137526</a><br><a href="http://www.libcode.com.cn/show.php?sid=84">代码下载网:http://www.libcode.com.cn/show.php?sid=84</a><br><a href="http://www.pudn.com/downloads231/sourcecode/others/detail1090515.html">程序员联合网:http://www.pudn.com/downloads231/sourcecode/others/detail1090515.html</a><br><br>demo程序代码如下:<br>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080">&nbsp;1</span>&nbsp;<span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;2</span>&nbsp;<span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;3</span>&nbsp;<span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">GEngine</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">AudioDevice.hpp</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;4</span>&nbsp;<span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">cmath</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;5</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;6</span>&nbsp;<span style="COLOR: #000000"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br></span><span style="COLOR: #008080">&nbsp;7</span>&nbsp;<span style="COLOR: #000000"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;core;&nbsp;<br></span><span style="COLOR: #008080">&nbsp;8</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">&nbsp;9</span>&nbsp;<span style="COLOR: #000000"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;argc,&nbsp;</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">argv[])<br></span><span style="COLOR: #008080">10</span>&nbsp;<span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;core::AudioDevice</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;device&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;InitAudioDevice();<br></span><span style="COLOR: #008080">12</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;uint16&nbsp;number&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">GetAudioDeviceNumber();<br></span><span style="COLOR: #008080">13</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">音频设备个数:</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">number</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;<br></span><span style="COLOR: #008080">14</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;number&nbsp;;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">!&nbsp;std::copy(begin.end.ostream<img src="http://www.cppblog.com/Images/dot.gif">)</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">15</span>&nbsp;<span style="COLOR: #008000"></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">16</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;std::cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">GetDeviceByIndex(i)</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">std::endl;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">17</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="COLOR: #008080">18</span>&nbsp;<span style="COLOR: #000000"><br></span><span style="COLOR: #008080">19</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">init&nbsp;is:&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Init(device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">GetDeviceByIndex(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">),</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;<br></span><span style="COLOR: #008080">20</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;AudioSource</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;audio&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">GetAudioSource();<br></span><span style="COLOR: #008080">21</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;AudioListener</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;listener&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">GetAudioListener();&nbsp;&nbsp;<br></span><span style="COLOR: #008080">22</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">AttachLowPassFiler();<br></span><span style="COLOR: #008080">23</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">AttachAuxiliaryEffect();<br></span><span style="COLOR: #008080">24</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Play(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">..\\audio//theme2.ogg</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">25</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetSourcePosition(Vector3f(</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">));<br></span><span style="COLOR: #008080">26</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetRelative(</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">);&nbsp;<br></span><span style="COLOR: #008080">27</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetMaxDistance(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">28</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetMinDistance(</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">29</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetVolume(</span><span style="COLOR: #000000">1.2f</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">30</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;listener</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">SetPosition(Vector3f(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">));&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">31</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">float</span><span style="COLOR: #000000">&nbsp;t&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0.0f</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">32</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;step&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">33</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">34</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">35</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(step&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">300</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">36</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="COLOR: #008080">37</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;step&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">38</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0.01</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">39</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="COLOR: #008080">40</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;listener</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Move(Vector3f(</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sinf(t),</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">cosf(t)));<br></span><span style="COLOR: #008080">41</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;audio</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Move(Vector3f(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">));<br></span><span style="COLOR: #008080">42</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;step</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">43</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="COLOR: #008080">44</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;device</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Deinit();<br></span><span style="COLOR: #008080">45</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;DeinitAudioDevice();<br></span><span style="COLOR: #008080">46</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;<br></span><span style="COLOR: #008080">47</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;system(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">PAUSE</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">48</span>&nbsp;<span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;EXIT_SUCCESS;<br></span><span style="COLOR: #008080">49</span>&nbsp;<span style="COLOR: #000000">}</span></div>
<br><br>精简版的盖莫音频引擎只包含1个头文件,1个a/lib，一个so/dll文件！<br>发布版本为win32下的gcc版本<br><br>盖莫家园在这里:<br><a href="http://www.gaimo.net/"><font color=#000000>盖莫Engine游戏引擎网:</font>www.gaimo.net</a><br><a href="http://bbs.gameres.com/showforum.asp?forumid=113">盖莫论坛:http://bbs.gameres.com/showforum.asp?forumid=113</a><br><br>许可证:<br>本版本使用于非商业完全免费<br>使用于商业只需要付给少量许可费以供继续开发和维护即可！<br>有疑问请联系email:ccsdu2009@126.com<br>成都盖莫软件技术工作室<br><br>如果所给例子出现异常请确保已经安装openal,如果异常依然存在则重新编译示例即可运行
<img src ="http://www.cppblog.com/gaimor/aggbug/109960.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/gaimor/" target="_blank">ccsdu2009</a> 2010-03-18 09:57 <a href="http://www.cppblog.com/gaimor/archive/2010/03/18/109960.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用批处理实现局域网IP快速同步</title><link>http://www.cppblog.com/issayandfaye/archive/2010/03/18/109957.html</link><dc:creator>iSsay</dc:creator><author>iSsay</author><pubDate>Thu, 18 Mar 2010 01:17:00 GMT</pubDate><guid>http://www.cppblog.com/issayandfaye/archive/2010/03/18/109957.html</guid><wfw:comment>http://www.cppblog.com/issayandfaye/comments/109957.html</wfw:comment><comments>http://www.cppblog.com/issayandfaye/archive/2010/03/18/109957.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/issayandfaye/comments/commentRss/109957.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/issayandfaye/services/trackbacks/109957.html</trackback:ping><description><![CDATA[<p>@echo off<br>color 27<br>echo --------------------------------------------------------<br>echo -------------------局域网IP同步小助手-------------------<br>echo -------------------------------------------by Issay-----<br>:main<br>echo ------------输入"y"同步局域网IP&nbsp; -----------------★★★<br>echo ------------输入"n"取消IP同步---------------------★★★<br>echo ------------输入"q"退出---------------------------★★★<br>SET /P choice=请选择操作项: <br>if /i '%choice:~0,1%'=='y' goto start<br>if /i '%choice:~0,1%'=='n' goto stop<br>if /i '%choice:~0,1%'=='q' exit<br>goto main</p>
<p>:start<br>echo ...<br>netsh interface ip set address "本地连接" static 192.168.2.41 255.255.255.0<br>echo Mission Completed!<br>pause<br>exit</p>
<p>:stop<br>echo ...<br>netsh interface ip set address name = "本地连接" source = dhcp<br>echo Mission Completed!<br>pause<br>exit<br></p>
<img src ="http://www.cppblog.com/issayandfaye/aggbug/109957.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/issayandfaye/" target="_blank">iSsay</a> 2010-03-18 09:17 <a href="http://www.cppblog.com/issayandfaye/archive/2010/03/18/109957.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>集成 CrashReporting，收集用户崩溃报告</title><link>http://www.cppblog.com/stevenyao/archive/2010/03/17/109945.html</link><dc:creator>姚冬</dc:creator><author>姚冬</author><pubDate>Wed, 17 Mar 2010 15:58:00 GMT</pubDate><guid>http://www.cppblog.com/stevenyao/archive/2010/03/17/109945.html</guid><wfw:comment>http://www.cppblog.com/stevenyao/comments/109945.html</wfw:comment><comments>http://www.cppblog.com/stevenyao/archive/2010/03/17/109945.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cppblog.com/stevenyao/comments/commentRss/109945.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/stevenyao/services/trackbacks/109945.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 今天尝试集成了CrashRpt，感觉还不错，功能很完善，集成也很容易。<br>http://code.google.com/p/crashrpt/&nbsp;&nbsp;<a href='http://www.cppblog.com/stevenyao/archive/2010/03/17/109945.html'>阅读全文</a><img src ="http://www.cppblog.com/stevenyao/aggbug/109945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/stevenyao/" target="_blank">姚冬</a> 2010-03-17 23:58 <a href="http://www.cppblog.com/stevenyao/archive/2010/03/17/109945.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>汕头大学技术交流之一</title><link>http://www.cppblog.com/cool-liangbing/archive/2010/03/17/109935.html</link><dc:creator>梁-兄</dc:creator><author>梁-兄</author><pubDate>Wed, 17 Mar 2010 14:43:00 GMT</pubDate><guid>http://www.cppblog.com/cool-liangbing/archive/2010/03/17/109935.html</guid><wfw:comment>http://www.cppblog.com/cool-liangbing/comments/109935.html</wfw:comment><comments>http://www.cppblog.com/cool-liangbing/archive/2010/03/17/109935.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cppblog.com/cool-liangbing/comments/commentRss/109935.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cool-liangbing/services/trackbacks/109935.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 这是我在3月6日在汕头大学至诚书院3楼的技术交流ppt。&nbsp;&nbsp;<a href='http://www.cppblog.com/cool-liangbing/archive/2010/03/17/109935.html'>阅读全文</a><img src ="http://www.cppblog.com/cool-liangbing/aggbug/109935.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cool-liangbing/" target="_blank">梁-兄</a> 2010-03-17 22:43 <a href="http://www.cppblog.com/cool-liangbing/archive/2010/03/17/109935.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>讨论：shader与矩阵转置</title><link>http://www.cppblog.com/sunicdavy/archive/2010/03/17/109879.html</link><dc:creator>Davy.xu</dc:creator><author>Davy.xu</author><pubDate>Wed, 17 Mar 2010 03:08:00 GMT</pubDate><guid>http://www.cppblog.com/sunicdavy/archive/2010/03/17/109879.html</guid><wfw:comment>http://www.cppblog.com/sunicdavy/comments/109879.html</wfw:comment><comments>http://www.cppblog.com/sunicdavy/archive/2010/03/17/109879.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/sunicdavy/comments/commentRss/109879.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sunicdavy/services/trackbacks/109879.html</trackback:ping><description><![CDATA[<p>完成自己的shader系统后，翻出之前写过的代码中发现有一个地方很奇怪</p> <p>我的矩阵定义跟OGRE的没什么区别</p> <div class="csharpcode"><pre class="alt">        union </pre><pre>        {</pre><pre class="alt">            <span class="kwrd">struct</span></pre><pre>            {</pre><pre class="alt">                <span class="kwrd">float</span> m11, m12, m13, m14;</pre><pre>                <span class="kwrd">float</span> m21, m22, m23, m24;</pre><pre class="alt">                <span class="kwrd">float</span> m31, m32, m33, m34;</pre><pre>                <span class="kwrd">float</span> m41, m42, m43, m44;</pre><pre class="alt">            };</pre><pre>            <span class="kwrd">float</span> m[4][4];</pre><pre class="alt">        };</pre></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>&nbsp;&nbsp; 乘法也跟OGRE的一模一样，但在将view及project乘好的矩阵送给HLSL时，却必须转置下，才能得到正确的结果</p>
<div class="csharpcode"><pre class="alt">mSkinnedEffect.mMatrix.mValue = (camera.mViewMatrix * camera.mProjectMatrix).Transpose();</pre></div>
<p>shader:</p>
<div class="csharpcode"><pre class="alt">float4 localpos = mul(In.Position, skinTransform);</pre></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp; OGRE中有这么一段代码及注释:</p>
<div class="csharpcode"><pre class="alt">    <span class="kwrd">const</span> Matrix4&amp; AutoParamDataSource::getProjectionMatrix(<span class="kwrd">void</span>) <span class="kwrd">const</span></pre><pre>    {</pre><pre class="alt">        <span class="kwrd">if</span> (mProjMatrixDirty)</pre><pre>        {</pre><pre class="alt">            <span class="rem">// NB use API-independent projection matrix since GPU programs</span></pre><pre>            <span class="rem">// bypass the API-specific handedness and use right-handed coords</span></pre><pre class="alt">            <span class="kwrd">if</span> (mCurrentRenderable &amp;&amp; mCurrentRenderable-&gt;getUseIdentityProjection())</pre><pre>            {</pre><pre class="alt">                <span class="rem">// Use identity projection matrix, still need to take RS depth into account.</span></pre><pre>                RenderSystem* rs = Root::getSingleton().getRenderSystem();</pre><pre class="alt">                rs-&gt;_convertProjectionMatrix(Matrix4::IDENTITY, mProjectionMatrix, <span class="kwrd">true</span>);</pre><pre>            }</pre><pre class="alt">            <span class="kwrd">else</span></pre><pre>            {</pre><pre class="alt">                mProjectionMatrix = mCurrentCamera-&gt;getProjectionMatrixWithRSDepth();</pre><pre>            }</pre><pre class="alt">            <span class="kwrd">if</span> (mCurrentRenderTarget &amp;&amp; mCurrentRenderTarget-&gt;requiresTextureFlipping())</pre><pre>            {</pre><pre class="alt">                <span class="rem">// Because we're not using setProjectionMatrix, this needs to be done here</span></pre><pre>                <span class="rem">// Invert transformed y</span></pre><pre class="alt">                mProjectionMatrix[1][0] = -mProjectionMatrix[1][0];</pre><pre>                mProjectionMatrix[1][1] = -mProjectionMatrix[1][1];</pre><pre class="alt">                mProjectionMatrix[1][2] = -mProjectionMatrix[1][2];</pre><pre>                mProjectionMatrix[1][3] = -mProjectionMatrix[1][3];</pre><pre class="alt">            }</pre><pre>            mProjMatrixDirty = <span class="kwrd">false</span>;</pre><pre class="alt">        }</pre><pre>        <span class="kwrd">return</span> mProjectionMatrix;</pre><pre class="alt">    }</pre></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>貌似是跟左右手这个恶心的东西有关系</p>
<p>回看DirectXSDK中提供的BasicHLSL例子</p>
<div class="csharpcode"><pre class="alt">        mWorld = g_mCenterWorld * *g_Camera.GetWorldMatrix();</pre><pre>        mProj = *g_Camera.GetProjMatrix();</pre><pre class="alt">        mView = *g_Camera.GetViewMatrix();</pre><pre>&nbsp;</pre><pre class="alt">        mWorldViewProjection = mWorld * mView * mProj;</pre><pre>&nbsp;</pre><pre class="alt">        V( g_pEffect-&gt;SetMatrix( <span class="str">"g_mWorldViewProjection"</span>, &amp;mWorldViewProjection ) );</pre></div>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p></p>
<p>shader：</p><pre class="csharpcode">Output.Position = mul(vAnimatedPos, g_mWorldViewProjection);</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>丝毫无需转置矩阵,Effect接口中也提供有SetMatrixTranspose这类方法。所以排除内部有自动转置的嫌疑。</p>
<p>询问过野猪这个问题，野猪答曰:"转置后传输至需要传3个vector, 最后一个是[0 0 0 1]” </p>
<p>有达人知道的，可以指点下迷津 :)</p><img src ="http://www.cppblog.com/sunicdavy/aggbug/109879.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sunicdavy/" target="_blank">Davy.xu</a> 2010-03-17 11:08 <a href="http://www.cppblog.com/sunicdavy/archive/2010/03/17/109879.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VMware小助手，做了一些小的调整。若不能适用某个版本请留言，我会做相应的修正。</title><link>http://www.cppblog.com/issayandfaye/archive/2010/03/17/109877.html</link><dc:creator>iSsay</dc:creator><author>iSsay</author><pubDate>Wed, 17 Mar 2010 02:50:00 GMT</pubDate><guid>http://www.cppblog.com/issayandfaye/archive/2010/03/17/109877.html</guid><wfw:comment>http://www.cppblog.com/issayandfaye/comments/109877.html</wfw:comment><comments>http://www.cppblog.com/issayandfaye/archive/2010/03/17/109877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/issayandfaye/comments/commentRss/109877.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/issayandfaye/services/trackbacks/109877.html</trackback:ping><description><![CDATA[<p style="FONT-FAMILY: 宋体"><font color=#ff0000 size=3>文中的虚拟网卡禁用功能，使用了微软DevCon 设备控制工具，下载地址：</font><a href="http://support.microsoft.com/kb/311272/zh-cn"><font color=#ff0000 size=3><u>http://support.microsoft.com/kb/311272/zh-cn</u></font></a></p>
<p style="FONT-FAMILY: 宋体"><font color=#ff0000>解压相应操作系统的.EXE文件，至批处理文件同目录下即可。</font></p>
<p style="FONT-FAMILY: 宋体"><u></u></p>
<p style="FONT-FAMILY: 宋体"><font color=#ff0000 size=3>功能：</font></p>
<p style="FONT-FAMILY: 宋体"><font color=#ff0000 size=3>禁用/启用 虚拟机相关服务</font></p>
<p style="FONT-FAMILY: 宋体"><font color=#ff0000 size=3>关闭/启动 虚拟机相关服务</font></p>
<p style="FONT-FAMILY: 宋体"><font color=#ff0000 size=3>关闭/启动 虚拟机相关程序</font></p>
<p><font color=#ff0000 size=3>禁用/启用 虚拟网卡</font></p>
<p>@echo off<br>color 27<br>echo --------------------------------------------------------<br>echo ----------------------VMware小助手----------------------<br>echo -------------------------------------------by Issay-----<br>echo --------------------------------------------------------<br>echo ------------输入"r"开启虚拟机服务-----------------★★★<br>echo ------------输入"s"关闭虚拟机服务-----------------★★★<br>echo --------------------------------------------------★★★<br>SET /P choice=请选择操作项: <br>if /i '%choice:~0,1%'=='r' goto start<br>if /i '%choice:~0,1%'=='s' goto stop<br>exit</p>
<p>:start<br>echo -----------------------------------------------------------<br>echo 正在安装虚拟机相关服务<br>sc config VMAuthdService start= auto<br>sc config VMnetDHCP start= auto<br>sc config "VMware NAT Service" start= auto<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo 正在启动虚拟机相关服务<br>echo ...<br>net start VMAuthdService<br>net start VMnetDHCP<br>net start "VMware NAT Service"<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo 正在启动虚拟机相关程序<br>echo ...<br>start "D:\VMware Workstation\vmnat.exe"<br>start "D:\VMware Workstation\VMnetDHCP.exe"<br>start "D:\VMware Workstation\vmware-authd.exe"<br>echo ...<br>echo finished！ <br>echo -----------------------------------------------------------<br>echo 正在启用虚拟网络<br>echo ...<br>devcon.exe enable *vmnetadapter1<br>devcon.exe enable *vmnetadapter8<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo ---------虚拟机准备完毕，请启动程序-----------<br>echo -------------------请按任意键退出-------------------<br>echo -----------------------------------------------------------<br>pause<br>exit</p>
<p>:stop<br>echo -----------------------------------------------------------<br>echo 正在结束虚拟机相关程序<br>echo ...<br>taskkill /f /t /im vmnat.exe<br>taskkill /f /t /im vmnetdhcp.exe<br>taskkill /f /t /im vmware-authd.exe<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo 正在关闭虚拟机相关服务<br>echo ...<br>net stop VMAuthdService<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo 正在卸载虚拟机相关服务<br>echo...<br>sc config VMAuthdService start= disabled<br>sc config VMnetDHCP start= disabled<br>sc config "VMware NAT Service" start= disabled<br>echo ...<br>echo finished！ <br>echo -----------------------------------------------------------<br>echo 正在禁用虚拟网络<br>echo ...<br>devcon.exe disable *vmnetadapter1<br>devcon.exe disable *vmnetadapter8<br>echo ...<br>echo finished！<br>echo -----------------------------------------------------------<br>echo --------WMware优化完毕！---------<br>echo -------------------请按任意键退出-------------------<br>echo -----------------------------------------------------------<br>pause<br>exit </p>
<img src ="http://www.cppblog.com/issayandfaye/aggbug/109877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/issayandfaye/" target="_blank">iSsay</a> 2010-03-17 10:50 <a href="http://www.cppblog.com/issayandfaye/archive/2010/03/17/109877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TC 464 DIV 2 1000 穷搜所有状态</title><link>http://www.cppblog.com/abilitytao/archive/2010/03/17/109862.html</link><dc:creator>abilitytao</dc:creator><author>abilitytao</author><pubDate>Tue, 16 Mar 2010 17:14:00 GMT</pubDate><guid>http://www.cppblog.com/abilitytao/archive/2010/03/17/109862.html</guid><wfw:comment>http://www.cppblog.com/abilitytao/comments/109862.html</wfw:comment><comments>http://www.cppblog.com/abilitytao/archive/2010/03/17/109862.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/abilitytao/comments/commentRss/109862.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/abilitytao/services/trackbacks/109862.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;&nbsp;#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;vector&gt;using&nbsp;namespace&nbsp;std;char&nbsp;str[100][100];int&nbsp;v[100][100];int&nbsp;n,m;int&nbsp;vv[100...&nbsp;&nbsp;<a href='http://www.cppblog.com/abilitytao/archive/2010/03/17/109862.html'>阅读全文</a><img src ="http://www.cppblog.com/abilitytao/aggbug/109862.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/abilitytao/" target="_blank">abilitytao</a> 2010-03-17 01:14 <a href="http://www.cppblog.com/abilitytao/archive/2010/03/17/109862.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【Boost.Python】unbound method 错误</title><link>http://www.cppblog.com/mythma/archive/2010/03/16/109847.html</link><dc:creator>力为</dc:creator><author>力为</author><pubDate>Tue, 16 Mar 2010 12:17:00 GMT</pubDate><guid>http://www.cppblog.com/mythma/archive/2010/03/16/109847.html</guid><wfw:comment>http://www.cppblog.com/mythma/comments/109847.html</wfw:comment><comments>http://www.cppblog.com/mythma/archive/2010/03/16/109847.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/mythma/comments/commentRss/109847.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/mythma/services/trackbacks/109847.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 最近看了下用Boost.Python封装C++供Python调用。在捣鼓的过程中遇到一个费解的异常：<br>TypeError: unbound method Boost.Python.function object must be called with MyClass instance as first argument (got nothing instead)<br>最终尽管可以正常使用了，但仍是一头雾水。&nbsp;&nbsp;<a href='http://www.cppblog.com/mythma/archive/2010/03/16/109847.html'>阅读全文</a><img src ="http://www.cppblog.com/mythma/aggbug/109847.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/mythma/" target="_blank">力为</a> 2010-03-16 20:17 <a href="http://www.cppblog.com/mythma/archive/2010/03/16/109847.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OpenCV学习笔记（一）</title><link>http://www.cppblog.com/deercoder/archive/2010/03/16/109818.html</link><dc:creator>刘畅</dc:creator><author>刘畅</author><pubDate>Tue, 16 Mar 2010 05:21:00 GMT</pubDate><guid>http://www.cppblog.com/deercoder/archive/2010/03/16/109818.html</guid><wfw:comment>http://www.cppblog.com/deercoder/comments/109818.html</wfw:comment><comments>http://www.cppblog.com/deercoder/archive/2010/03/16/109818.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/deercoder/comments/commentRss/109818.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/deercoder/services/trackbacks/109818.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: OpenCV								学习笔记																																																 																								March 12, 2010																										1.								       ...&nbsp;&nbsp;<a href='http://www.cppblog.com/deercoder/archive/2010/03/16/109818.html'>阅读全文</a><img src ="http://www.cppblog.com/deercoder/aggbug/109818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/deercoder/" target="_blank">刘畅</a> 2010-03-16 13:21 <a href="http://www.cppblog.com/deercoder/archive/2010/03/16/109818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[总结]LL(1)分析法及其实现</title><link>http://www.cppblog.com/kevinlynx/archive/2010/03/15/109765.html</link><dc:creator>Kevin Lynx</dc:creator><author>Kevin Lynx</author><pubDate>Mon, 15 Mar 2010 13:33:00 GMT</pubDate><guid>http://www.cppblog.com/kevinlynx/archive/2010/03/15/109765.html</guid><wfw:comment>http://www.cppblog.com/kevinlynx/comments/109765.html</wfw:comment><comments>http://www.cppblog.com/kevinlynx/archive/2010/03/15/109765.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/kevinlynx/comments/commentRss/109765.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/kevinlynx/services/trackbacks/109765.html</trackback:ping><description><![CDATA[<p><font size=2>LL(1)分析法和递归下降分析法同属于自顶向下分析法。相对于递归下降而言，LL通过显示<br>地维护一个栈来进行语法分析，递归下降则是利用了函数调用栈。 </font>
<p><font size=2>LL分析法主要由分析栈、分析表和一个驱动算法组成。其实LL的分析算法还是很容易懂的，<br>主要就是一个匹配替换的过程。而要构造这里的分析表，则还涉及计算first集和follow集<br>的算法。 </font></p>
<p><a href="http://www.cppblog.com/images/cppblog_com/kevinlynx/WindowsLiveWriter/LL1_12DFD/1_2.jpg"><img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=1 border=0 alt=1 src="http://www.cppblog.com/images/cppblog_com/kevinlynx/WindowsLiveWriter/LL1_12DFD/1_thumb.jpg" width=391 height=346></a> </p>
<p><font size=2>个人觉得龙书在解释这些算法和概念时都非常清楚细致，虽然也有人说它很晦涩。 </font>
<p><font size=2>first集和follow集的计算，抛开书上给的严密算法，用人的思维去理解（对于compiler<br>compiler则需要用程序去构造这些集合，这是让计算机去理解），其实很简单： </font>
<p><font size=2>1、对于某个非终结符A的first集（first(A)），简单地说就是由A推导得到的串的首符号的<br>集合：A-&gt;aB，那么这里的a就属于first(A)，很形象。<br>2、follow(A)，则是紧随A的终结符号集合，例如B-&gt;Aa，这里的a就属于follow(A)，也很形<br>象。 </font>
<p><font size=2>当然，因为文法符号中有epsilon，所以在计算上面两个集合时则会涉及到一种传递性。例<br>如，A-&gt;Bc, B-&gt;epsilon，B可以推导出epsilon，也就是基本等同于没有，那么first(A)中<br>就会包含c符号。 </font>
<p><font size=2>在了解了first集和follow集的计算方法后，则可以通过另一些规则构造出LL需要的分析表。 </font>
<p><font size=2>编译原理里总有很多很多的理论和算法。但正是这些理论和算法，使得编译器的实现变得简<br>单，代码易维护。 </font>
<p><font size=2>在某个特定的编程语言中，因为其文法一定，所以对于其LL(1)实现中的分析表就是确定的<br>。我们也不需要在程序里动态构造first和follow集合。 </font>
<p><font size=2>那么，要实现一个LL(1)分析法，大致步骤就集中于：设计文法-&gt;建立该文法的分析表-&gt;编<br>码。 </font>
<p><font size=2>LL分析法是不能处理左递归文法的，例如：expr-&gt;expr + term，因为左递归文法会让对应<br>的分析表里某一项存在多个候选式。这里，又会涉及到消除左递归的方法。这个方法也很简<br>单，只需要把文法推导式代入如下的公式即可： </font>
<p><font size=2>A -&gt; AB | C 等价于：A -&gt; CX, X -&gt; BX | epsilon </font>
<p><font size=2>最后一个问题是，如何在LL分析过程中建立抽象语法树呢？虽然这里的LL分析法可以检查文<br>法对应的语言是否合法有效，但是似乎还不能做任何有意义的事情。这个问题归结于语法制<br>导翻译，一般在编译原理教程中语法分析后的章节里。 </font>
<p><font size=2>LL分析法最大的悲剧在于将一棵在人看来清晰直白的语法树分割了。在递归下降分析法中，<br>一个树节点所需要的属性（例如算术运算符所需要的操作数）可以直接由其子节点得到。但<br>是，在为了消除左递归而改变了的文法式子中，一个节点所需要的属性可能跑到其兄弟节点<br>或者父节点中去了。貌似这里可以参考&#8220;继承属性&#8221;概念。 </font>
<p><font size=2>不过，综合而言，我们有很多业余的手段来处理这种问题，例如建立属性堆栈。具体来说，<br>例如对于例子代码中计算算术表达式，就可以把表达式中的数放到一个栈里。 </font>
<p><font size=2>例子中，通过在文法表达式中插入动作符号来标识一个操作。例如对于文法：<br>expr2-&gt;addop term expr2，则可以改为：expr2-&gt;addop term # expr2。当发现分析栈的栈<br>顶元素是'#'时，则在属性堆栈里取出操作数做计算。例子中还将操作符压入了堆栈。 </font>
<p><font size=2><a href="http://www.cppblog.com/Files/kevinlynx/LL1.rar" target=_blank>下载例子</a>，例子代码最好对照arith_expr.txt中写的文法和分析表来看。 </font>
<p><font size=2>PS，最近在<a href="http://blog.codingnow.com/2005/12/compare_with_lua_5.html#comment-338" target=_blank>云风博客中看到他给的一句评论</a>，我觉得很有道理，并且延伸开来可以说明我们<br>周围的很多现象： </font>
<p><font size=2>&#8221;很多东西，意识不到问题比找不到解决方法要严重很多。比如one-pass 这个，觉得实现<br>麻烦不去实现，和觉得实现没有意义不去实现就是不同的。&#8220; </font>
<p><font size=2>对于以下现象，这句话都可以指明问题：<br>1、认为造轮子没有意义，从不考虑自己是否能造出；<br>2、常告诉别人某个技术复杂晦涩不利于团队使用，却并不懂这个技术；<br>3、笼统来说，【觉得】太多东西没有意义，虽然并不真正懂这个东西。 </font></p>
<img src ="http://www.cppblog.com/kevinlynx/aggbug/109765.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/kevinlynx/" target="_blank">Kevin Lynx</a> 2010-03-15 21:33 <a href="http://www.cppblog.com/kevinlynx/archive/2010/03/15/109765.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>