锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久亚洲精品无码播放,久久99亚洲网美利坚合众国,国产精品99久久精品爆乳http://www.shnenglu.com/yzhw/category/15192.htmlzh-cnSat, 18 Feb 2012 12:09:06 GMTSat, 18 Feb 2012 12:09:06 GMT60pku3907 姹傚杈瑰艦闈㈢Нhttp://www.shnenglu.com/yzhw/archive/2012/02/18/165874.htmlyzhwyzhwFri, 17 Feb 2012 17:34:00 GMThttp://www.shnenglu.com/yzhw/archive/2012/02/18/165874.htmlhttp://www.shnenglu.com/yzhw/comments/165874.htmlhttp://www.shnenglu.com/yzhw/archive/2012/02/18/165874.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/165874.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/165874.html
 1 Show Code - Run ID 1166912
 2 
 3 Submit Time: 2012-02-18 01:33:04     Language: GNU C     Result: Accepted
 4     Pid: 3124     Time: 0.00 sec.     Memory: 852 K.     Code Length: 0.6 K.
 5 # include <stdio.h>
 6 # define cross(x1,y1,x2,y2) (x1)*(y2)-(x2)*(y1)
 7 # define get_aera(x0,y0,x1,y1,x2,y2) (cross((x1)-(x0),(y1)-(y0),(x2)-(x0),(y2)-(y0)))
 8 int main()
 9 {
10     int n;
11     while(scanf("%d",&n)!=EOF&&n)
12     {
13        int i;
14       
15            double x[3],y[3],aera=0;
16            scanf("%lf%lf",&x[2],&y[2]);
17            for(i=1;i<n;i++)
18            {
19                scanf("%lf%lf",&x[i%2],&y[i%2]);
20                if(i>1) aera+=get_aera(x[2],y[2],x[(i+1)%2],y[(i+1)%2],x[i%2],y[i%2]);
21            }
22            aera*=0.5;
23            if(aera<0) aera=-aera;
24            printf("%.0f\n",aera+1e-8);
25        
26     }
27     return 0;
28 }


yzhw 2012-02-18 01:34 鍙戣〃璇勮
]]>
pku1948 Triangular Pastures DP+鏋氫婦銆傛搗浼﹀叕寮?/title><link>http://www.shnenglu.com/yzhw/archive/2011/02/05/139735.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Fri, 04 Feb 2011 17:02:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/02/05/139735.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/139735.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/02/05/139735.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/139735.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/139735.html</trackback:ping><description><![CDATA[ 棰樻剰<br>緇欏嚭涓浜涙湪媯掞紝闂兘鍚︾敤榪欎簺鏈ㄦ鎷兼垚涓夎褰紝濡傛灉鍙兘姹傛渶澶х殑闈㈢Н銆?br><br>瑙f硶錛?br>鍏堢粰鍑轟竴涓畾鐞嗭細嫻蜂雞鍏紡<br><img src="http://imgsrc.baidu.com/baike/abpic/item/b258f5c4664154e98226ace2.jpg" id="" vspace="0" hspace="0" border="" align="baseline" alt="" longdesc=""><br>涓嬮潰灝辨槸鏋氫婦杈歸暱銆傞鍏堟灇涓炬渶闀胯竟c錛岀敱浜庝袱杈逛箣鍜屽ぇ浜庣涓夎竟錛宑鐨勯暱搴﹀繀欏誨皬浜庡懆闀跨殑涓鍗婏紝榪欐槸涓涓噸瑕佺殑鍓灊銆傚鏋滆繕瑕佸壀鏋濓紝鍙互鍏堜竴嬈P姹傚緱鐢辨湪媯嶇粍鍚堝彲浠ヨ揪鍒扮殑闀垮害銆?br>紜畾c浠ュ悗鍐嶆灇涓綼錛岀劧鍚庡啀嬈″彲浠ョ敤DP楠岃瘉鏈ㄦ鑳藉惁緇勫悎鎴恆銆乧鐨勯暱搴︺傝繖閲屽彲浠ュ啀涓嬈″壀鏋濓紝鏋氫婦c鐨勬椂鍊欏緩璁粠鍛ㄩ暱鐨勪竴鍗婂悜涓嬫灇涓撅紝鍘熷洜寰堢畝鍗曪紝灝介噺鏋勯犱竴涓緝浼樼殑鍚堟硶瑙o紝鏍規(guī)嵁嫻蜂雞鍏紡(p-a)(p-b)(p-c)錛屽綋c紜畾鏃舵渶澶у肩殑浣嶇疆涔熸竻妤氫簡錛坆鍜宑鐩哥瓑鐨勪綅緗紝濡傛灉鍦ㄦ渶浼樹綅緗紙涓婇檺錛屽彲鑳借揪涓嶅埌錛夐兘涓嶈兘姣旀渶浼樿В浼橈紝灝辯洿鎺ut錛夈傜劧鍚庝笅闈㈠氨娌′粈涔堥毦搴︿簡銆?br><br>浠g爜錛?br><div style="background-color: rgb(238, 238, 238); font-size: 13px; border-left-color: rgb(204, 204, 204); padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080; "> 1</span> <span style="color: #000000; "># include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdio</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 2</span> <span style="color: #000000; "># include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstring</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 3</span> <span style="color: #000000; "># include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdlib</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 4</span> <span style="color: #000000; "># include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cmath</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 5</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">using</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br></span><span style="color: #008080; "> 6</span> <span style="color: #000000; "># include </span><span style="color: #000000; "><</span><span style="color: #000000; ">algorithm</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 7</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> dp[</span><span style="color: #000000; ">2</span><span style="color: #000000; ">][</span><span style="color: #000000; ">855</span><span style="color: #000000; ">][</span><span style="color: #000000; ">855</span><span style="color: #000000; ">];<br></span><span style="color: #008080; "> 8</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> plen[</span><span style="color: #000000; ">1605</span><span style="color: #000000; ">],pc</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; "> 9</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> n,len[</span><span style="color: #000000; ">41</span><span style="color: #000000; ">];<br></span><span style="color: #008080; ">10</span> <span style="color: #000000; "><br></span><span style="color: #008080; ">11</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main()<br></span><span style="color: #008080; ">12</span> <span style="color: #000000; ">{<br></span><span style="color: #008080; ">13</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> total</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">14</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; ">&</span><span style="color: #000000; ">n);<br></span><span style="color: #008080; ">15</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">16</span> <span style="color: #000000; ">    {<br></span><span style="color: #008080; ">17</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; ">,len</span><span style="color: #000000; ">+</span><span style="color: #000000; ">i);<br></span><span style="color: #008080; ">18</span> <span style="color: #000000; ">      total</span><span style="color: #000000; ">+=</span><span style="color: #000000; ">len[i];<br></span><span style="color: #008080; ">19</span> <span style="color: #000000; ">    }<br></span><span style="color: #008080; ">20</span> <span style="color: #000000; ">    sort(len,len</span><span style="color: #000000; ">+</span><span style="color: #000000; ">n);<br></span><span style="color: #008080; ">21</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> tmp[</span><span style="color: #000000; ">1606</span><span style="color: #000000; ">];<br></span><span style="color: #008080; ">22</span> <span style="color: #000000; ">    memset(tmp,</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(tmp));<br></span><span style="color: #008080; ">23</span> <span style="color: #000000; ">    memset(dp[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],</span><span style="color: #000000; ">0</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(dp[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]));<br></span><span style="color: #008080; ">24</span> <span style="color: #000000; ">    dp[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</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> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><=</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">26</span> <span style="color: #000000; ">    {<br></span><span style="color: #008080; ">27</span> <span style="color: #000000; ">      memset(dp[i</span><span style="color: #000000; ">%</span><span style="color: #000000; ">2</span><span style="color: #000000; ">],</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(dp[i</span><span style="color: #000000; ">%</span><span style="color: #000000; ">2</span><span style="color: #000000; ">]));<br></span><span style="color: #008080; ">28</span> <span style="color: #000000; ">      </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> j</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;j</span><span style="color: #000000; "><=</span><span style="color: #000000; ">total</span><span style="color: #000000; ">/</span><span style="color: #000000; ">2</span><span style="color: #000000; ">+</span><span style="color: #000000; ">40</span><span style="color: #000000; ">;j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">29</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> k</span><span style="color: #000000; ">=</span><span style="color: #000000; ">j;k</span><span style="color: #000000; "><=</span><span style="color: #000000; ">total</span><span style="color: #000000; ">/</span><span style="color: #000000; ">2</span><span style="color: #000000; ">+</span><span style="color: #000000; ">40</span><span style="color: #000000; ">;k</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">30</span> <span style="color: #000000; ">           </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(j</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[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; ">0</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">dp[(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; ">2</span><span style="color: #000000; ">][min(j</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">],k)][max(j</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">],k)]</span><span style="color: #000000; ">||</span><span style="color: #000000; "><br></span><span style="color: #008080; ">31</span> <span style="color: #000000; ">              k</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[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; ">0</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">dp[(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; ">2</span><span style="color: #000000; ">][min(j,k</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">])][max(k</span><span style="color: #000000; ">-</span><span style="color: #000000; ">len[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">],j)]</span><span style="color: #000000; ">||</span><span style="color: #000000; "><br></span><span style="color: #008080; ">32</span> <span style="color: #000000; ">              dp[(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; ">2</span><span style="color: #000000; ">][j][k])<br></span><span style="color: #008080; ">33</span> <span style="color: #000000; ">              dp[i</span><span style="color: #000000; ">%</span><span style="color: #000000; ">2</span><span style="color: #000000; ">][j][k]</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">34</span> <span style="color: #000000; ">    }<br></span><span style="color: #008080; ">35</span> <span style="color: #000000; ">    <br></span><span style="color: #008080; ">36</span> <span style="color: #000000; ">    tmp[len[</span><span style="color: #000000; ">0</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; ">37</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">38</span> <span style="color: #000000; ">      </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> j</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;j</span><span style="color: #000000; "><=</span><span style="color: #000000; ">total;j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">39</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(tmp[j]</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">j</span><span style="color: #000000; ">+</span><span style="color: #000000; ">len[i]</span><span style="color: #000000; "><=</span><span style="color: #000000; ">total)<br></span><span style="color: #008080; ">40</span> <span style="color: #000000; ">          tmp[j</span><span style="color: #000000; ">+</span><span style="color: #000000; ">len[i]]</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">41</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><=</span><span style="color: #000000; ">total;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">42</span> <span style="color: #000000; ">       </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(tmp[i])<br></span><span style="color: #008080; ">43</span> <span style="color: #000000; ">          plen[pc</span><span style="color: #000000; ">++</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">i;<br></span><span style="color: #008080; ">44</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> best</span><span style="color: #000000; ">=-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">45</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> c</span><span style="color: #000000; ">=</span><span style="color: #000000; ">lower_bound(plen,plen</span><span style="color: #000000; ">+</span><span style="color: #000000; ">pc,total</span><span style="color: #000000; ">/</span><span style="color: #000000; ">2</span><span style="color: #000000; ">)</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;c</span><span style="color: #000000; ">>=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;c</span><span style="color: #000000; ">--</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">46</span> <span style="color: #000000; ">    {<br></span><span style="color: #008080; ">47</span> <span style="color: #000000; ">       </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> a</span><span style="color: #000000; ">=</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c])</span><span style="color: #000000; ">/</span><span style="color: #000000; ">2</span><span style="color: #000000; ">,b</span><span style="color: #000000; ">=</span><span style="color: #000000; ">total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">a;<br></span><span style="color: #008080; ">48</span> <span style="color: #000000; ">       </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(best</span><span style="color: #000000; ">!=-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">plen[c])</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">a)</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">b)</span><span style="color: #000000; "><</span><span style="color: #000000; ">best) </span><span style="color: #0000FF; ">continue</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">49</span> <span style="color: #000000; ">       </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(a</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;plen[a]</span><span style="color: #000000; "><</span><span style="color: #000000; ">total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c];a</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">50</span> <span style="color: #000000; ">         </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(plen[c]</span><span style="color: #000000; ">>=</span><span style="color: #000000; ">plen[a]</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">plen[c]</span><span style="color: #000000; ">>=</span><span style="color: #000000; ">total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[a]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c]</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">dp[n</span><span style="color: #000000; ">%</span><span style="color: #000000; ">2</span><span style="color: #000000; ">][plen[a]][plen[c]]</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">(best</span><span style="color: #000000; ">==-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">||</span><span style="color: #000000; ">best</span><span style="color: #000000; "><</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">plen[c])</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">plen[a])</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[a]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c]))))<br></span><span style="color: #008080; ">51</span> <span style="color: #000000; ">             best</span><span style="color: #000000; ">=</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">plen[c])</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">plen[a])</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">2</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(total</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[a]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">plen[c]));<br></span><span style="color: #008080; ">52</span> <span style="color: #000000; ">    }<br></span><span style="color: #008080; ">53</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(best</span><span style="color: #000000; ">==-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">) printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">-1\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">54</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "><br></span><span style="color: #008080; ">55</span> <span style="color: #000000; ">    {<br></span><span style="color: #008080; ">56</span> <span style="color: #000000; ">        best</span><span style="color: #000000; ">=</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">)(sqrt(best</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">)total)</span><span style="color: #000000; ">*</span><span style="color: #000000; ">25</span><span style="color: #000000; ">+</span><span style="color: #000000; ">1e</span><span style="color: #000000; ">-</span><span style="color: #000000; ">6</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">57</span> <span style="color: #000000; ">        printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,best);<br></span><span style="color: #008080; ">58</span> <span style="color: #000000; ">    }<br></span><span style="color: #008080; ">59</span> <span style="color: #000000; ">    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">system("pause");</span><span style="color: #008000; "><br></span><span style="color: #008080; ">60</span> <span style="color: #008000; "></span><span style="color: #000000; ">    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">61</span> <span style="color: #000000; ">      <br></span><span style="color: #008080; ">62</span> <span style="color: #000000; ">}<br></span><span style="color: #008080; ">63</span> <span style="color: #000000; "></span></div><img src ="http://www.shnenglu.com/yzhw/aggbug/139735.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-02-05 01:02 <a href="http://www.shnenglu.com/yzhw/archive/2011/02/05/139735.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku2894-2903 Tehran 2005 姣旇禌鎬葷粨http://www.shnenglu.com/yzhw/archive/2011/01/31/139630.htmlyzhwyzhwSun, 30 Jan 2011 17:59:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/31/139630.htmlhttp://www.shnenglu.com/yzhw/comments/139630.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/31/139630.html#Feedback1http://www.shnenglu.com/yzhw/comments/commentRss/139630.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/139630.html闃呰鍏ㄦ枃

yzhw 2011-01-31 01:59 鍙戣〃璇勮
]]>
pku1244 Slots of Fun 綆鍗曞嚑浣?/title><link>http://www.shnenglu.com/yzhw/archive/2011/01/20/138944.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Wed, 19 Jan 2011 18:57:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/01/20/138944.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/138944.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/01/20/138944.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/138944.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/138944.html</trackback:ping><description><![CDATA[棰樼洰錛?br><img src="http://poj.org/images/1244_1.jpg" id="" vspace="0" hspace="0" border="" align="baseline" alt="" longdesc=""><img src="http://poj.org/images/1244_1.jpg" id="" vspace="0" hspace="0" border="" align="baseline" alt="" longdesc=""><br>緇欏嚭涓猲琛岀殑涓夎錛屾瘡涓渾閲屽寘鍚竴涓瓧姣嶏紝闂摢浜涘瓧姣嶈兘澶熺粍鎴愮瓑杈逛笁瑙掑艦錛堟瘡涓瓧姣嶈嚦澶氬嚭鐜?嬈★級<br><br>瑙f硶錛?br>鎴戠敤浜嗕釜寰堟噿鐨勬柟娉曪紝綆楁瘡涓渾涓績鐐圭殑鍧愭爣錛岀劧鍚庣湅涓夌偣璺濈鏄惁鐩哥瓑銆傚叧浜庢眰鍧愭爣鍏跺疄榪樻槸寰堢畝鍗曠殑- -鐢ㄥ悜閲忕殑鏂規(guī)硶銆?br>絎竴琛岀涓涓潗鏍囪涓猴紙0錛?錛夛紝璁劇疆鍏冨悜閲?-0.5,-0.5*sqrt(3))錛岀劧鍚庢瘡涓琛岀涓涓厓绱犲潗鏍囧氨鏄笂琛岀涓涓厓绱犲潗鏍?鍏冨悜閲忥紝姣忎竴琛岀i涓厓绱犲潗鏍囦負絎琲-1涓潗鏍?鍗曚綅鍚戦噺銆?br><br>浠g爜錛?br><div style="background-color: rgb(238, 238, 238); font-size: 13px; border-left-color: rgb(204, 204, 204); padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008080; "> 1</span> <span style="color: #008000; ">//</span><span style="color: #008000; ">============================================================================<br></span><span style="color: #008080; "> 2</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; "> Name        : pku1244.cpp<br></span><span style="color: #008080; "> 3</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; "> Author      : yzhw<br></span><span style="color: #008080; "> 4</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; "> Version     :<br></span><span style="color: #008080; "> 5</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; "> Copyright   : yzhw<br></span><span style="color: #008080; "> 6</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; "> Description : Hello World in C++, Ansi-style<br></span><span style="color: #008080; "> 7</span> <span style="color: #008000; "></span><span style="color: #008000; ">//</span><span style="color: #008000; ">============================================================================</span><span style="color: #008000; "><br></span><span style="color: #008080; "> 8</span> <span style="color: #008000; "></span><span style="color: #000000; "><br></span><span style="color: #008080; "> 9</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">iostream</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">10</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdio</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">11</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstring</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">12</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cmath</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">13</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">algorithm</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">14</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">functional</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">15</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">vector</span><span style="color: #000000; ">></span><span style="color: #000000; "><br></span><span style="color: #008080; ">16</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">using</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; "> std;<br></span><span style="color: #008080; ">17</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> x</span><span style="color: #000000; ">=-</span><span style="color: #000000; ">0.5</span><span style="color: #000000; ">,y</span><span style="color: #000000; ">=</span><span style="color: #000000; ">x</span><span style="color: #000000; ">*</span><span style="color: #000000; ">sqrt(</span><span style="color: #000000; ">3.0</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">18</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> n;<br></span><span style="color: #008080; ">19</span> <span style="color: #000000; ">inline </span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> dis(pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; "> a,pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; "> b)<br></span><span style="color: #008080; ">20</span> <span style="color: #000000; ">{<br></span><span style="color: #008080; ">21</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> (a.first</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.first)</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(a.first</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.first)</span><span style="color: #000000; ">+</span><span style="color: #000000; ">(a.second</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.second)</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(a.second</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.second);<br></span><span style="color: #008080; ">22</span> <span style="color: #000000; ">}<br></span><span style="color: #008080; ">23</span> <span style="color: #000000; ">inline </span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> equ(</span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> a,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> b)<br></span><span style="color: #008080; ">24</span> <span style="color: #000000; ">{<br></span><span style="color: #008080; ">25</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> fabs(a</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b)</span><span style="color: #000000; "><</span><span style="color: #000000; ">1e</span><span style="color: #000000; ">-</span><span style="color: #000000; ">6</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">26</span> <span style="color: #000000; ">}<br></span><span style="color: #008080; ">27</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main() {<br></span><span style="color: #008080; ">28</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">double</span><span style="color: #000000; "> data[</span><span style="color: #000000; ">20</span><span style="color: #000000; ">][</span><span style="color: #000000; ">20</span><span style="color: #000000; ">][</span><span style="color: #000000; ">2</span><span style="color: #000000; ">];<br></span><span style="color: #008080; ">29</span> <span style="color: #000000; ">    </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; ">&</span><span style="color: #000000; ">n)</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">n)<br></span><span style="color: #008080; ">30</span> <span style="color: #000000; ">    {<br></span><span style="color: #008080; ">31</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> str[</span><span style="color: #000000; ">255</span><span style="color: #000000; ">];<br></span><span style="color: #008080; ">32</span> <span style="color: #000000; ">        vector</span><span style="color: #000000; "><</span><span style="color: #000000; ">pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; "> </span><span style="color: #000000; ">></span><span style="color: #000000; "> map[</span><span style="color: #000000; ">26</span><span style="color: #000000; ">];<br></span><span style="color: #008080; ">33</span> <span style="color: #000000; ">        scanf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%s</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,str);<br></span><span style="color: #008080; ">34</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; ">p</span><span style="color: #000000; ">=</span><span style="color: #000000; ">str;<br></span><span style="color: #008080; ">35</span> <span style="color: #000000; ">        data[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">36</span> <span style="color: #000000; ">        data[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</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; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">37</span> <span style="color: #000000; ">        map[</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(p</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)</span><span style="color: #000000; ">-</span><span style="color: #000000; ">97</span><span style="color: #000000; ">].push_back(make_pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; ">(data[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],data[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]));<br></span><span style="color: #008080; ">38</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><</span><span style="color: #000000; ">n;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">39</span> <span style="color: #000000; ">        {<br></span><span style="color: #008080; ">40</span> <span style="color: #000000; ">            data[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">data[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]</span><span style="color: #000000; ">+</span><span style="color: #000000; ">x;<br></span><span style="color: #008080; ">41</span> <span style="color: #000000; ">            data[i][</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; ">data[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">][</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; ">y;<br></span><span style="color: #008080; ">42</span> <span style="color: #000000; ">            map[</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(p</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)</span><span style="color: #000000; ">-</span><span style="color: #000000; ">97</span><span style="color: #000000; ">].push_back(make_pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; ">(data[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],data[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]));<br></span><span style="color: #008080; ">43</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><=</span><span style="color: #000000; ">i;j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">44</span> <span style="color: #000000; ">            {<br></span><span style="color: #008080; ">45</span> <span style="color: #000000; ">                data[i][j][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">data[i][j</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">][</span><span style="color: #000000; ">0</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; ">46</span> <span style="color: #000000; ">                data[i][j][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">data[i][j</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></span><span style="color: #008080; ">47</span> <span style="color: #000000; ">                map[</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(p</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)</span><span style="color: #000000; ">-</span><span style="color: #000000; ">97</span><span style="color: #000000; ">].push_back(make_pair</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">></span><span style="color: #000000; ">(data[i][j][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],data[i][j][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]));<br></span><span style="color: #008080; ">48</span> <span style="color: #000000; ">            }<br></span><span style="color: #008080; ">49</span> <span style="color: #000000; ">        }<br></span><span style="color: #008080; ">50</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> flag</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">51</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</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; "><</span><span style="color: #000000; ">26</span><span style="color: #000000; ">;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">52</span> <span style="color: #000000; ">            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(map[i].size()</span><span style="color: #000000; ">==</span><span style="color: #000000; ">3</span><span style="color: #000000; ">)<br></span><span style="color: #008080; ">53</span> <span style="color: #000000; ">            {<br></span><span style="color: #008080; ">54</span> <span style="color: #000000; ">                </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(equ(dis(map[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],map[i][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]),dis(map[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],map[i][</span><span style="color: #000000; ">2</span><span style="color: #000000; ">]))</span><span style="color: #000000; ">&&</span><span style="color: #000000; ">equ(dis(map[i][</span><span style="color: #000000; ">0</span><span style="color: #000000; ">],map[i][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]),dis(map[i][</span><span style="color: #000000; ">1</span><span style="color: #000000; ">],map[i][</span><span style="color: #000000; ">2</span><span style="color: #000000; ">])))<br></span><span style="color: #008080; ">55</span> <span style="color: #000000; ">                        {<br></span><span style="color: #008080; ">56</span> <span style="color: #000000; ">                            printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%c</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,i</span><span style="color: #000000; ">+</span><span style="color: #000000; ">97</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">57</span> <span style="color: #000000; ">                            flag</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">58</span> <span style="color: #000000; ">                        }<br></span><span style="color: #008080; ">59</span> <span style="color: #000000; ">            }<br></span><span style="color: #008080; ">60</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(flag) printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">61</span> <span style="color: #000000; ">        </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "> printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">LOOOOOOOOSER!\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br></span><span style="color: #008080; ">62</span> <span style="color: #000000; ">    }<br></span><span style="color: #008080; ">63</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br></span><span style="color: #008080; ">64</span> <span style="color: #000000; "><br></span><span style="color: #008080; ">65</span> <span style="color: #000000; ">}<br></span><span style="color: #008080; ">66</span> <span style="color: #000000; "></span></div><img src ="http://www.shnenglu.com/yzhw/aggbug/138944.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-01-20 02:57 <a href="http://www.shnenglu.com/yzhw/archive/2011/01/20/138944.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku 1266 ural 1043 Cover an Arc. 瑙f瀽鍑犱綍錛屾敞鎰忔誕鐐規(guī)暟涓嬪彇鏁磋鐢╢loor鍑芥暟http://www.shnenglu.com/yzhw/archive/2011/01/18/138725.htmlyzhwyzhwTue, 18 Jan 2011 02:44:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/18/138725.htmlhttp://www.shnenglu.com/yzhw/comments/138725.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/18/138725.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138725.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138725.html闃呰鍏ㄦ枃

yzhw 2011-01-18 10:44 鍙戣〃璇勮
]]>
pku 1231 The Alphabet Game 寰堝ソ鐨勬暟鎹粨鏋勯鐩?/title><link>http://www.shnenglu.com/yzhw/archive/2011/01/17/138621.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Sun, 16 Jan 2011 16:55:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/01/17/138621.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/138621.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/01/17/138621.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/138621.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/138621.html</trackback:ping><description><![CDATA[     鎽樿: 棰樻剰鏄繖鏍鳳細涓涓牸鏉夸笂鍐欐湁k*n涓瓧姣嶏紝絎琲涓瓧姣嶆湁k涓傜劧鍚庨棶鑳藉惁鐢ㄨ瘡絀挎暣涓柟鏍兼澘鐨勬í綰垮拰绔栫嚎灝嗕笉鍚岀殑瀛楁瘝鍒嗗紑銆傝В娉曪細棣栧厛錛屽亣璁炬垜浠皢k涓悓涓涓瓧姣嶇敤涓涓猲*m鐨勭煩褰㈡妗嗕綇錛岃繖棰樺氨杞崲涓鴻繖鏍蜂竴涓棶棰橈細騫抽潰涓婄粰鍑轟竴浜涚煩褰紝鑳藉惁鐢ㄧ敤涓浜涙按騫蟲垨绔栫洿綰垮皢騫抽潰鍒掑垎寮錛屼嬌寰楁瘡涓涓尯鍩熶腑鏈変笖浠呮湁涓涓煩褰€備笅闈㈢殑鎯蟲硶灝辨湁鐐瑰閥濡欙紝棣栧厛錛屾í鍚戠殑鍒囧壊涓庣旱鍚戠殑鍒囧壊鏄浉浜掔嫭绔嬬殑錛屽氨鏄錛屾棤璁烘按騫崇嚎鎬庝箞鐢諱笌绔栫洿綰跨殑瀹夋帓鏃犲叧...  <a href='http://www.shnenglu.com/yzhw/archive/2011/01/17/138621.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/yzhw/aggbug/138621.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-01-17 00:55 <a href="http://www.shnenglu.com/yzhw/archive/2011/01/17/138621.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku 1265 aera pick瀹氱悊http://www.shnenglu.com/yzhw/archive/2011/01/16/138587.htmlyzhwyzhwSat, 15 Jan 2011 16:07:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/16/138587.htmlhttp://www.shnenglu.com/yzhw/comments/138587.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/16/138587.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138587.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138587.html
璁$畻綾諱技榪欐牱涓涓浘褰㈢殑闈㈢Н銆佽竟涓婄殑鏍肩偣鏁般佸唴閮ㄦ牸鐐規(guī)暟

瑙f硶錛?br>榪欓噷鐢ㄥ埌涓涓畾鐞嗭紝鍙玴ick瀹氱悊
闈㈢Н=杈逛笂鐐規(guī)暟/2-1+鍐呴儴鐐規(guī)暟
鐒跺悗姹傝竟涓婄殑鐐規(guī)暟鐩存帴鐢╣cd(dx,dy)灝卞彲浠ヤ簡銆?br>緗戞牸鍥炬槸涓涓濂囩殑鍥撅紝閲岄潰鏈夊緢澶氳寮傜殑緇撹銆?br>
pick瀹氱悊
Pick瀹氱悊鐨勫嚑涓嚭浜烘剰鏂欑殑搴旂敤 (鎽樿嚜matrix67)
Pick瀹氱悊鐨勫嚑涓嚭浜烘剰鏂欑殑搴旂敤 (鎽樿嚜matrix67)
2009-11-13 11:34

   

     鑰冭檻鐩寸嚎x+y=n錛屽叾涓璶鏄竴涓礌鏁般傝繖鏉$洿綰垮皢鎭板ソ閫氳繃絎竴璞¢檺閲岀殑n-1涓牸鐐癸紙濡備笂鍥撅紝鍥句腑鎵紺虹殑鏄痭=11鐨勬儏鍐碉級銆傚皢榪檔-1涓偣鍒嗗埆鍜屽師鐐圭浉榪烇紝浜庢槸寰楀埌浜唍-2涓伆鑹茬殑涓夎褰€備粩緇嗘暟鏁版瘡涓笁瑙掑艦鍐呴儴鐨勬牸鐐規(guī)暟錛屼綘浼氬彂鐜頒竴涓儕浜虹殑浜嬪疄錛氭瘡涓笁瑙掑艦鍐呴儴鎵鍚殑鏍肩偣鏁伴兘鏄竴鏍峰銆傝繖鏄負浠涔堝憿錛?/p>


   

     Pick瀹氱悊鏄錛屽湪涓涓鉤闈㈢洿瑙掑潗鏍囩郴鍐咃紝濡傛灉涓涓杈瑰艦鐨勯《鐐瑰叏閮藉湪鏍肩偣涓婏紝閭d箞榪欎釜鍥懼艦鐨勯潰縐伆濂藉氨絳変簬杈圭晫涓婄粡榪囩殑鏍肩偣鏁扮殑涓鍗婂姞涓婂唴閮ㄦ墍鍚牸鐐規(guī)暟鍐嶅噺涓銆備緥濡傦紝涓婂浘澶氳竟褰㈢殑杈圭晫涓婃湁8涓牸鐐癸紝鍐呴儴鍚湁7涓牸鐐癸紝閭d箞鍏墮潰縐氨絳変簬8/2+7-1=10銆傛垜浠浘緇忓湪榪欓噷鐪嬪埌榪囦竴涓潪甯哥濂囬潪甯歌寮傜殑璇佹槑銆傝繖涓畾鐞嗘湁涓浜涢潪甯稿閥濡欑殑搴旂敤銆傚湪涓婇潰鐨勯棶棰橀噷錛屾墍鏈変笁瑙掑艦閮芥槸絳夊簳絳夐珮鐨勶紝鍥犳瀹冧滑鐨勯潰縐兘鐩哥瓑銆傚彟澶栵紝娉ㄦ剰鍒皒涓巠鐨勫拰鏄竴涓礌鏁幫紝榪欒〃鏄巟鍜寉鏄簰绱犵殑錛堝惁鍒檟+y鍙互鎻愬嚭涓涓叕鍥犳暟d錛屼笌鍜屼負绱犳暟鐭涚浘錛夛紝涔熷氨鏄(x,y)鍜屽師鐐圭殑榪炵嚎涓嶄細緇忚繃鍏跺畠鏍肩偣銆傛棦鐒舵墍鏈変笁瑙掑艦鐨勯潰縐兘鐩哥瓑錛岃竟鐣屼笂鐨勬牸鐐規(guī)暟涔熺浉絳夛紝鐢盤ick瀹氱悊錛屾垜浠氨鑳界洿鎺ュ緱鍑烘瘡涓笁瑙掑艦鍐呴儴鐨勬牸鐐規(guī)暟涔熺浉絳変簡銆?/p>

     鍙︿竴涓湁瓚g殑闂鍒欐槸錛屼竴涓猲*n鐨勬鏂瑰艦鏈澶氬彲浠ヨ鐩栧灝戜釜鏍肩偣錛熸妸榪欎釜姝f柟褰腑瑙勪腑鐭╁湴鏀懼湪鐩磋鍧愭爣緋諱笂錛屾樉鐒惰兘澶熻鐩?n+1)^2涓牸鐐廣傝矊浼艱繖宸茬粡鏄渶澶氱殑浜嗭紝涓嶈繃濡備綍璇佹槑鍛紵鍒╃敤Pick瀹氱悊錛屾垜浠兘澶熷緢蹇鏄庡畠鐨勬渶浼樻с傛敞鎰忓埌鐢變簬浠諱袱涓牸鐐歸棿鏈榪戜篃鏈変竴涓崟浣嶇殑闂磋窛錛屽啀鑰冭檻鍒版鏂瑰艦鐨勫懆闀夸負4n錛屽洜姝よ姝f柟褰㈢殑杈圭晫涓婃渶澶氭湁4n涓牸鐐廣傛妸姝f柟褰㈣竟鐣屼笂鐨勬牸鐐規(guī)暟璁頒綔B錛屽唴閮ㄦ墍鍚牸鐐規(guī)暟璁頒負I錛屼簬鏄畠鎵鑳借鐩栫殑鎬繪牸鐐規(guī)暟絳変簬I+B錛岀敱浜嶪+B = I+B/2-1 + B/2+1 ≤ n^2 + 4n/2 + 1 = (n+1)^2錛岀粨璁虹珛鍗沖緱璇併?/p>

     涓涓笢瑗挎渶鍑虹鍏ュ寲鐨勮繍鐢ㄨ繕鏄浜庨偅浜涗笌瀹冨叓鏉嗗瓙鎵撲笉鐫鐨勫湴鏂廣侳arey搴忓垪鏄寚鎶婂湪0鍒?涔嬮棿鐨勬墍鏈夊垎姣嶄笉瓚呰繃n鐨勫垎鏁頒粠灝忓埌澶ф帓鍒楄搗鏉ユ墍褰㈡垚鐨勬暟鍒楋紝鎴戜滑鎶婂畠璁頒綔F_n銆備緥濡傦紝F_5灝辨槸

0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1/1

   

     Farey搴忓垪鏈変竴涓濂囩殑鎬ц川錛氬墠涓欏圭殑鍒嗘瘝涔樹互鍚庝竴欏圭殑鍒嗗瓙錛屼竴瀹氭瘮鍓嶄竴欏圭殑鍒嗗瓙涓庡悗涓欏瑰垎姣嶄箣縐ぇ1銆傜敤Pick瀹氱悊鏉ヨ瘉鏄庤繖涓粨璁哄紓甯哥畝鍗曘傛妸鍒嗘瘝涓嶈秴榪噉鐨勬瘡涓涓?鍜?涔嬮棿鐨勫垎鏁伴兘鏍囧湪騫抽潰鐩磋鍧愭爣緋諱笂錛屼緥濡?/1灝卞搴旂偣(1,0)錛?/5灝卞搴旂偣(5,1)銆傝冭檻涓鏍逛粠鍘熺偣鍑哄彂鐨勫皠綰跨敱x杞存鏂瑰悜閫嗘椂閽堟參鎱㈣漿鍔ㄥ埌y杞存鏂瑰悜錛岃繖鏍瑰皠綰夸緷嬈℃壂榪囩殑鏍囪鐐規(guī)伆濂藉氨鏄竴涓狥arey搴忓垪錛堝洜涓篎arey搴忓垪鐩稿綋浜庢槸緇欐瘡涓爣璁扮偣鐨勬枩鐜囨帓搴忥級銆傝冭檻榪欐牴灝勭嚎鎵繃鐨勪袱涓浉閭葷殑鏍囪鐐癸紝瀹冧滑涓庡師鐐規(guī)墍緇勬垚鐨勪笁瑙掑艦闈㈢Н涓瀹氫負1/2鈥斺旂敱浜庡垎鏁伴兘鏄渶綆鍒嗘暟錛屽洜姝ゅ畠浠笌鍘熺偣鐨勮繛綰夸笂娌℃湁鏍肩偣錛涘張鍥犱負榪欐槸灝勭嚎鎵繃鐨勪袱涓浉閭葷殑鏍囪鐐癸紝鍥犳涓夎褰㈠唴閮ㄦ病鏈変換浣曟牸鐐廣傚彟澶栨敞鎰忓埌錛岀敱浜庝笁瑙掑艦闈㈢Н絳変簬鍙夌Н鐨勪竴鍗婏紝鍥犳涓や釜鐐?m,n)鍜?p,q)涓庡師鐐圭粍鎴愮殑涓夎褰㈤潰縐簲璇ヤ負(mq-np)/2銆備簬鏄紝瀵逛簬Farey搴忓垪鐨勪袱涓浉閭誨垎鏁皀/m鍜宷/p錛屾垜浠湁(mq-np)/2 = 1/2錛屽嵆mq-np=1銆?/p>



浠g爜錛?br>
 1# include <stdio.h>
 2# define cross(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
 3int p[105][2];
 4int gcd(int n1,int n2)
 5{
 6    if(n1<0) n1*=-1;
 7    if(n2<0) n2*=-1;
 8    while(n2)
 9    {
10       int t=n1%n2;
11       n1=n2;
12       n2=t;
13    }

14    return n1;
15}

16int main()
17{
18    //freopen("ans.txt","w",stdout);
19    int test,t;
20    scanf("%d",&test);
21    for(t=1;t<=test;t++)
22    {
23         int n,i;
24         int aera=0,edge=0;
25         scanf("%d",&n);
26         for(i=1;i<=n;i++)
27         {
28           scanf("%d%d",&p[i][0],&p[i][1]);
29           edge+=gcd(p[i][0],p[i][1]);
30         }

31         p[0][0]=p[0][1]=0;
32         for(i=1;i<n;i++)
33            p[i][0]+=p[i-1][0],p[i][1]+=p[i-1][1];
34         for(i=2;i<n;i++)
35             aera+=cross(p[i-1][0],p[i-1][1],p[i][0],p[i][1]);
36         printf("Scenario #%d:\n%d %d %.1f\n\n",t,(int)((aera+2-edge)*0.5+1e-6),edge,aera*0.5);     
37    }

38   // system("pause");
39   return 0;
40}

41



yzhw 2011-01-16 00:07 鍙戣〃璇勮
]]>
pku 1228 Grandpa's Estate 鍑稿杈瑰艦鐨勫敮涓鎬э紙鍑稿寘錛?/title><link>http://www.shnenglu.com/yzhw/archive/2011/01/15/138554.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Fri, 14 Jan 2011 18:27:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/01/15/138554.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/138554.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/01/15/138554.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/138554.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/138554.html</trackback:ping><description><![CDATA[棰樻剰錛?br>涓涓嚫澶氳竟褰㈢殑杈圭晫涓婃湁鑻ュ共鏈ㄦ々錛岀幇涓㈠け閮ㄥ垎鏈ㄦ々錛岄棶鐢卞墿涓嬬殑鏈ㄦ々鑳藉惁鍞竴紜畾榪欎釜澶氳竟褰?br><br>瑙f硶錛?br>棣栧厛鑳藉鍞竴紜畾鐨勬潯浠舵槸鐢卞墿涓嬬殑鏈ㄦ々紜畾鐨勫嚫鍖呯殑姣忔潯杈逛笂鑷沖皯鍖呭惈3涓湪妗╋紝榪欎釜鑷繁鐢誨浘姣斿垝涓嬪氨鐭ラ亾浜? -<br>鐒跺悗灝辨槸姹備竴涓嚫鍖呬簡銆傚湪榪欑鍧愭爣閮芥槸鏁存暟鐨勬儏鍐典笅錛屽嚫鍖呮渶濂戒笉瑕佺敤atan2鍑芥暟錛岃屾槸鐢ㄥ弶縐潵姣旇緝銆傛垜鐗瑰湴鐢ㄧ函C鍐欎簡涓紝鏈夎鐨勭闉嬪彲浠ユ嬁鍘誨綋妯℃澘<br>鏈変釜闃撮櫓鐨勫湴鏂癸紝灝辨槸嫻嬭瘯鏁版嵁鍙湁3涓偣錛岃屼笖3鐐逛竴綰褲傘傘備綘鎳傜殑<br><br>浠g爜<br> <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"><span style="COLOR: #008080"> 1</span><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000">#  include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif">#  include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stdlib.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># define N </span><span style="COLOR: #000000">1200</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># define cross(x1,y1,x2,y2) ((x1)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(y2)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(x2)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(y1))<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># define min(a,b) ((a)</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">(b)</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">(a):(b))<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># define max(a,b) ((a)</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">(b)</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">(a):(b))<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif">typedef </span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img id=Codehighlighter1_196_208_Open_Image onclick="this.style.display='none'; Codehighlighter1_196_208_Open_Text.style.display='none'; Codehighlighter1_196_208_Closed_Image.style.display='inline'; Codehighlighter1_196_208_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_196_208_Closed_Image onclick="this.style.display='none'; Codehighlighter1_196_208_Closed_Text.style.display='none'; Codehighlighter1_196_208_Open_Image.style.display='inline'; Codehighlighter1_196_208_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_196_208_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_196_208_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> x,y;<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000">point;<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,c;<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif">point data[N],ans[N],std;<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> dis(point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">pos)<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img id=Codehighlighter1_271_345_Open_Image onclick="this.style.display='none'; Codehighlighter1_271_345_Open_Text.style.display='none'; Codehighlighter1_271_345_Closed_Image.style.display='inline'; Codehighlighter1_271_345_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_271_345_Closed_Image onclick="this.style.display='none'; Codehighlighter1_271_345_Closed_Text.style.display='none'; Codehighlighter1_271_345_Open_Image.style.display='inline'; Codehighlighter1_271_345_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_271_345_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_271_345_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> (pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">(pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y);<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> isin(point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">a,point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">b,point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">pos)<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img id=Codehighlighter1_386_584_Open_Image onclick="this.style.display='none'; Codehighlighter1_386_584_Open_Text.style.display='none'; Codehighlighter1_386_584_Closed_Image.style.display='inline'; Codehighlighter1_386_584_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_386_584_Closed_Image onclick="this.style.display='none'; Codehighlighter1_386_584_Closed_Text.style.display='none'; Codehighlighter1_386_584_Open_Image.style.display='inline'; Codehighlighter1_386_584_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_386_584_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_386_584_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">max(a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x)</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">min(a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x)</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">max(a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y)</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">min(a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y)) </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(cross(pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x,pos</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x,b</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> cmp(</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">a,</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">b)<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img id=Codehighlighter1_623_844_Open_Image onclick="this.style.display='none'; Codehighlighter1_623_844_Open_Text.style.display='none'; Codehighlighter1_623_844_Closed_Image.style.display='inline'; Codehighlighter1_623_844_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_623_844_Closed_Image onclick="this.style.display='none'; Codehighlighter1_623_844_Closed_Text.style.display='none'; Codehighlighter1_623_844_Open_Image.style.display='inline'; Codehighlighter1_623_844_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_623_844_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_623_844_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">aa</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)a,</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">bb</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(point </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)b;<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(cross(bb</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x,bb</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y,aa</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x,aa</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y))<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> cross(bb</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x,bb</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y,aa</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.x,aa</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">std.y);<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> <br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> dis(aa)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">dis(bb);<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> sort()<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img id=Codehighlighter1_858_1043_Open_Image onclick="this.style.display='none'; Codehighlighter1_858_1043_Open_Text.style.display='none'; Codehighlighter1_858_1043_Closed_Image.style.display='inline'; Codehighlighter1_858_1043_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_858_1043_Closed_Image onclick="this.style.display='none'; Codehighlighter1_858_1043_Closed_Text.style.display='none'; Codehighlighter1_858_1043_Open_Image.style.display='inline'; Codehighlighter1_858_1043_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_858_1043_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_858_1043_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0xfffffff</span><span style="COLOR: #000000">,y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0xfffffff</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </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"><</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(data[i].y</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">data[i].y</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">data[i].x</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">x)<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">data[i].y,x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">data[i].x;<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    std.x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">x;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    std.y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">y;<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    qsort(data,n,</span><span style="COLOR: #0000ff">sizeof</span><span style="COLOR: #000000">(point),cmp);<br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> build()<br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img id=Codehighlighter1_1058_1269_Open_Image onclick="this.style.display='none'; Codehighlighter1_1058_1269_Open_Text.style.display='none'; Codehighlighter1_1058_1269_Closed_Image.style.display='inline'; Codehighlighter1_1058_1269_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1058_1269_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1058_1269_Closed_Text.style.display='none'; Codehighlighter1_1058_1269_Open_Image.style.display='inline'; Codehighlighter1_1058_1269_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_1058_1269_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1058_1269_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i;<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    c</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    sort();<br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </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"><</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img id=Codehighlighter1_1102_1241_Open_Image onclick="this.style.display='none'; Codehighlighter1_1102_1241_Open_Text.style.display='none'; Codehighlighter1_1102_1241_Closed_Image.style.display='inline'; Codehighlighter1_1102_1241_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1102_1241_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1102_1241_Closed_Text.style.display='none'; Codehighlighter1_1102_1241_Open_Image.style.display='inline'; Codehighlighter1_1102_1241_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_1102_1241_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1102_1241_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(c</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">cross(data[i].x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">].x,data[i].y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">].y,ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">].x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">].x,ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">].y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">ans[c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">].y)</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) c</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        ans[c</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">data[i];<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(c</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) ans[c</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">ans[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> chk()<br></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img id=Codehighlighter1_1281_1441_Open_Image onclick="this.style.display='none'; Codehighlighter1_1281_1441_Open_Text.style.display='none'; Codehighlighter1_1281_1441_Closed_Image.style.display='inline'; Codehighlighter1_1281_1441_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1281_1441_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1281_1441_Closed_Text.style.display='none'; Codehighlighter1_1281_1441_Open_Image.style.display='inline'; Codehighlighter1_1281_1441_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_1281_1441_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1281_1441_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i;<br></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </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"><</span><span style="COLOR: #000000">c</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img id=Codehighlighter1_1312_1428_Open_Image onclick="this.style.display='none'; Codehighlighter1_1312_1428_Open_Text.style.display='none'; Codehighlighter1_1312_1428_Closed_Image.style.display='inline'; Codehighlighter1_1312_1428_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1312_1428_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1312_1428_Closed_Text.style.display='none'; Codehighlighter1_1312_1428_Open_Image.style.display='inline'; Codehighlighter1_1312_1428_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_1312_1428_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1312_1428_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> count</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,j;<br></span><span style="COLOR: #008080">60</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">n;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">61</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(isin(</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">ans[i],</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">ans[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">data[j]))<br></span><span style="COLOR: #008080">62</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">                count</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">63</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(count</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">) </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">64</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">65</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">66</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">67</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080">68</span><span style="COLOR: #000000"><img id=Codehighlighter1_1454_1676_Open_Image onclick="this.style.display='none'; Codehighlighter1_1454_1676_Open_Text.style.display='none'; Codehighlighter1_1454_1676_Closed_Image.style.display='inline'; Codehighlighter1_1454_1676_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1454_1676_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1454_1676_Closed_Text.style.display='none'; Codehighlighter1_1454_1676_Open_Image.style.display='inline'; Codehighlighter1_1454_1676_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_1454_1676_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1454_1676_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">69</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> test;<br></span><span style="COLOR: #008080">70</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    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">&</span><span style="COLOR: #000000">test);<br></span><span style="COLOR: #008080">71</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(test</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">72</span><span style="COLOR: #000000"><img id=Codehighlighter1_1503_1663_Open_Image onclick="this.style.display='none'; Codehighlighter1_1503_1663_Open_Text.style.display='none'; Codehighlighter1_1503_1663_Closed_Image.style.display='inline'; Codehighlighter1_1503_1663_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1503_1663_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1503_1663_Closed_Text.style.display='none'; Codehighlighter1_1503_1663_Open_Image.style.display='inline'; Codehighlighter1_1503_1663_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_1503_1663_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1503_1663_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">73</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i;<br></span><span style="COLOR: #008080">74</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        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">&</span><span style="COLOR: #000000">n);<br></span><span style="COLOR: #008080">75</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </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"><</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">76</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            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">&</span><span style="COLOR: #000000">data[i].x,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">data[i].y);<br></span><span style="COLOR: #008080">77</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        build();<br></span><span style="COLOR: #008080">78</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(c</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">chk()) printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">YES\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">79</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">NO\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">80</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">81</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">82</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">83</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span></div> <img src ="http://www.shnenglu.com/yzhw/aggbug/138554.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-01-15 02:27 <a href="http://www.shnenglu.com/yzhw/archive/2011/01/15/138554.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku 1264 SCUD Busters 鍑稿寘+鐐瑰湪褰㈠唴鍒ゆ柇+闈㈢Н璁$畻http://www.shnenglu.com/yzhw/archive/2011/01/15/138552.htmlyzhwyzhwFri, 14 Jan 2011 17:17:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/15/138552.htmlhttp://www.shnenglu.com/yzhw/comments/138552.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/15/138552.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138552.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138552.html闃呰鍏ㄦ枃

yzhw 2011-01-15 01:17 鍙戣〃璇勮
]]>
pku 1263 Reflections 瑙f瀽鍑犱綍http://www.shnenglu.com/yzhw/archive/2011/01/14/138513.htmlyzhwyzhwFri, 14 Jan 2011 03:45:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/14/138513.htmlhttp://www.shnenglu.com/yzhw/comments/138513.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/14/138513.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138513.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138513.html闃呰鍏ㄦ枃

yzhw 2011-01-14 11:45 鍙戣〃璇勮
]]>
pku 3668 Game of Lines hashhttp://www.shnenglu.com/yzhw/archive/2010/12/05/135489.htmlyzhwyzhwSat, 04 Dec 2010 17:26:00 GMThttp://www.shnenglu.com/yzhw/archive/2010/12/05/135489.htmlhttp://www.shnenglu.com/yzhw/comments/135489.htmlhttp://www.shnenglu.com/yzhw/archive/2010/12/05/135489.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/135489.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/135489.html棰樻剰錛?br>緇欏嚭涓浜涚偣錛屾眰鍑虹敱榪欎簺鐐瑰彲浠ユ瀯鎴愬灝戞枩鐜囦笉鍚岀殑綰挎銆?br>瑙f硶錛?br>O錛圢2錛夋灇涓劇洿綰匡紝鐒跺悗hash璁板綍鏂滅巼錛堣鐗瑰埆鑰冭檻鏂滅巼涓嶅瓨鍦ㄧ殑鎯呭喌錛夛紝娉ㄦ剰嫻偣鏁扮殑姣旇緝綺懼害鎺у埗鍦?e-8鎴栬呯敤pair鏉ラ氬垎姣旇緝銆傘?br>浠g爜錛?br>

 1# include <iostream>
 2# include <cmath>
 3using namespace std;
 4# include <set>
 5struct cmp
 6{
 7   bool operator()(const double a,const double b) const
 8   {
 9      return fabs(a-b)>1e-8&&a<b;
10   }

11}

12set<double,cmp> refer;
13bool sp=0;
14int data[201][2];
15int main()
16{
17   int n;
18   cin>>n;
19   for(int i=0;i<n;i++)
20   {
21     cin>>data[i][0]>>data[i][1];
22     for(int j=0;j<i;j++)
23       if(data[j][0]==data[i][0])
24         sp=1;
25       else
26          refer.insert((data[j][1]-data[i][1])/(double)(data[j][0]-data[i][0]));
27   }

28   cout<<refer.size()+sp<<endl;
29  // system("pause");
30   return 0;
31}

32


yzhw 2010-12-05 01:26 鍙戣〃璇勮
]]>
pku 1327 Moving Object Recognition 姹傜墿浣撹川蹇?/title><link>http://www.shnenglu.com/yzhw/archive/2010/10/19/130437.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Tue, 19 Oct 2010 06:27:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2010/10/19/130437.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/130437.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2010/10/19/130437.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/130437.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/130437.html</trackback:ping><description><![CDATA[榪欓娌′粈涔堝ソ璇寸殑銆傘傛眰涓涓粍鍚堜綋鐨勮川蹇冿紝榪樻槸閲囧彇鍏紡<img border=0 alt="" src="http://www.shnenglu.com/images/cppblog_com/yzhw/1327_2.jpg" width=169 height=77><br>璇″紓鐨勬槸榪欓亾棰樺湪TOJ涓婅繃涓嶅幓銆傘俹rz..<br> <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"><span style="COLOR: #008080"> 1</span><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><span style="COLOR: #000000"># include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstdio</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> map[</span><span style="COLOR: #000000">300</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">300</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> c,r;<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> dfs(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j,</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">x,</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">y,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">total)<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img id=Codehighlighter1_162_387_Open_Image onclick="this.style.display='none'; Codehighlighter1_162_387_Open_Text.style.display='none'; Codehighlighter1_162_387_Closed_Image.style.display='inline'; Codehighlighter1_162_387_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_162_387_Closed_Image onclick="this.style.display='none'; Codehighlighter1_162_387_Closed_Text.style.display='none'; Codehighlighter1_162_387_Open_Image.style.display='inline'; Codehighlighter1_162_387_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_162_387_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_162_387_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(i</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">r</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">j</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">j</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">c</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">map[i][j]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">) </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   map[i][j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   total</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   x</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">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">2.0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   y</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">j</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">2.0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   dfs(i</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,j,x,y,total);<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   dfs(i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,j,x,y,total);<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   dfs(i,j</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,x,y,total);<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   dfs(i,j</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,x,y,total);<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   <br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img id=Codehighlighter1_400_1480_Open_Image onclick="this.style.display='none'; Codehighlighter1_400_1480_Open_Text.style.display='none'; Codehighlighter1_400_1480_Closed_Image.style.display='inline'; Codehighlighter1_400_1480_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_400_1480_Closed_Image onclick="this.style.display='none'; Codehighlighter1_400_1480_Closed_Text.style.display='none'; Codehighlighter1_400_1480_Open_Image.style.display='inline'; Codehighlighter1_400_1480_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.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_400_1480_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_400_1480_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img id=Codehighlighter1_422_1464_Open_Image onclick="this.style.display='none'; Codehighlighter1_422_1464_Open_Text.style.display='none'; Codehighlighter1_422_1464_Closed_Image.style.display='inline'; Codehighlighter1_422_1464_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_422_1464_Closed_Image onclick="this.style.display='none'; Codehighlighter1_422_1464_Closed_Text.style.display='none'; Codehighlighter1_422_1464_Open_Image.style.display='inline'; Codehighlighter1_422_1464_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_422_1464_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_422_1464_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       vector</span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"> x,y;<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       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">&</span><span style="COLOR: #000000">c,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">r);<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">c</span><span style="COLOR: #000000">&&!</span><span style="COLOR: #000000">r) </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img id=Codehighlighter1_530_1202_Open_Image onclick="this.style.display='none'; Codehighlighter1_530_1202_Open_Text.style.display='none'; Codehighlighter1_530_1202_Closed_Image.style.display='inline'; Codehighlighter1_530_1202_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_530_1202_Closed_Image onclick="this.style.display='none'; Codehighlighter1_530_1202_Closed_Text.style.display='none'; Codehighlighter1_530_1202_Open_Image.style.display='inline'; Codehighlighter1_530_1202_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_530_1202_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_530_1202_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">          </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> maxnum</span><span style="COLOR: #000000">=-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">          </span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> totalx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,totaly</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">          </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</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"><</span><span style="COLOR: #000000">r;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%s</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,map[i]);<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">          </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</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"><</span><span style="COLOR: #000000">r;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">c;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(map[i][j]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img id=Codehighlighter1_763_1043_Open_Image onclick="this.style.display='none'; Codehighlighter1_763_1043_Open_Text.style.display='none'; Codehighlighter1_763_1043_Closed_Image.style.display='inline'; Codehighlighter1_763_1043_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_763_1043_Closed_Image onclick="this.style.display='none'; Codehighlighter1_763_1043_Closed_Text.style.display='none'; Codehighlighter1_763_1043_Open_Image.style.display='inline'; Codehighlighter1_763_1043_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_763_1043_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_763_1043_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               </span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> nowx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,nowy</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> total</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               dfs(i,j,nowx,nowy,total);<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(total</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">maxnum)<br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img id=Codehighlighter1_918_1029_Open_Image onclick="this.style.display='none'; Codehighlighter1_918_1029_Open_Text.style.display='none'; Codehighlighter1_918_1029_Closed_Image.style.display='inline'; Codehighlighter1_918_1029_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_918_1029_Closed_Image onclick="this.style.display='none'; Codehighlighter1_918_1029_Closed_Text.style.display='none'; Codehighlighter1_918_1029_Open_Image.style.display='inline'; Codehighlighter1_918_1029_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_918_1029_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_918_1029_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">                  maxnum</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">total;<br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">                  totalx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">nowx;<br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">                  totaly</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">nowy;<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">               }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">           x.push_back((totalx)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">maxnum);<br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">           y.push_back((totaly)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">maxnum);<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">           scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%s</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,map[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]);<br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">           </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(map[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">) </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">       }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       </span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> resx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,resy</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> T</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">x.size()</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</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"><</span><span style="COLOR: #000000">x.size()</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">T;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img id=Codehighlighter1_1302_1375_Open_Image onclick="this.style.display='none'; Codehighlighter1_1302_1375_Open_Text.style.display='none'; Codehighlighter1_1302_1375_Closed_Image.style.display='inline'; Codehighlighter1_1302_1375_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1302_1375_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1302_1375_Closed_Text.style.display='none'; Codehighlighter1_1302_1375_Open_Image.style.display='inline'; Codehighlighter1_1302_1375_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.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_1302_1375_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1302_1375_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         resx</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">(x[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">T]</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">x[i])</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">T;<br></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         resy</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">(y[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">T]</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">y[i])</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">T;<br></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">       }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       resx</span><span style="COLOR: #000000">/=</span><span style="COLOR: #000000">T;<br></span><span style="COLOR: #008080">60</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       resy</span><span style="COLOR: #000000">/=</span><span style="COLOR: #000000">T;<br></span><span style="COLOR: #008080">61</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">       printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%.2f %.2f\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,resy</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1e</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">,resx</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1e</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">62</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">63</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">64</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">65</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br></span><span style="COLOR: #008080">66</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span></div> <img src ="http://www.shnenglu.com/yzhw/aggbug/130437.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2010-10-19 14:27 <a href="http://www.shnenglu.com/yzhw/archive/2010/10/19/130437.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>PKU 3855 Blast the Enemy!http://www.shnenglu.com/yzhw/archive/2010/10/14/129901.htmlyzhwyzhwThu, 14 Oct 2010 09:58:00 GMThttp://www.shnenglu.com/yzhw/archive/2010/10/14/129901.htmlhttp://www.shnenglu.com/yzhw/comments/129901.htmlhttp://www.shnenglu.com/yzhw/archive/2010/10/14/129901.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/129901.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/129901.html娉ㄦ剰錛佹眰瑙e杈瑰艦鐨勮川蹇冧竴鑸皢鍏惰繘琛屽垎瑙o紝鐒跺悗鐢ㄨ川蹇?闈㈢Н鍜?鎬婚潰縐眰寰楁昏川蹇?br>Summary

緇欏嚭涓涓湁n(n<=100)涓偣鐨勭畝鍗曞杈瑰艦錛屾眰璇ュ杈瑰艦鐨勯噸蹇冦?

Solution

鏍規(guī)嵁澶氳竟褰㈤噸蹇冪殑瀹氫箟錛屽彲浠ュ鍏惰繘琛屼笁瑙掑墫鍒嗭紝璁$畻姣忎釜涓夎褰㈢殑闈㈢Н浠ュ強閲嶅績銆傚杈瑰艦鐨勯噸蹇冨氨鏄墍鏈変笁瑙掑艦鐨勯噸蹇冨闈㈢Н鐨勫姞鏉冨鉤鍧囨暟錛屼篃灝辨槸璇達細

center.x = (cen[0].x * area[0] + cen[1].x * area[1] ..... + cen[n].x * area[n]) / totalarea

center.y = (cen[0].y * area[0] + cen[1].y * area[1] ..... + cen[n].y * area[n]) / totalarea

cen[i]浠h〃絎琲涓笁瑙掑艦鐨勯噸蹇冿紝涓夎褰㈢殑閲嶅績?yōu)鏄Q?

center_of_tri.x=(p1.x+p2.x+p3.x)/3.0

center_of_tri.y=(p1.y+p2.y+p3.y)/3.0

area[i]灝辨槸絎琲涓笁瑙掑艦鐨勯潰縐倀otalarea灝辨槸澶氳竟褰㈢殑鎬婚潰縐?

 1#include <cstdio>
 2#include <cmath>
 3#define EPS 1e-8
 4#define N 105
 5struct POINT {
 6    double x, y;
 7    POINT() {
 8        x = y = 0;
 9    }

10    POINT(double x, double y) :
11        x(x), y(y) {
12    }

13    void get() {
14        scanf("%lf%lf"&x, &y);
15    }

16    void print() {
17        printf("%.6lf %.6lf\n", x, y);
18    }

19    POINT operator+(const POINT &p) {
20        return POINT(x + p.x, y + p.y);
21    }

22}
;
23POINT pl[N];
24int n;
25double cross(POINT o, POINT &a, POINT &b) {
26    return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
27}

28int sgn(double x) {
29    return x < -EPS ? -1 : x > EPS;
30}

31void solve() {
32    int i;
33    double area = 0;
34    POINT ct;
35    for (i = 0; i < n; i++)
36        pl[i].get();
37    pl[i] = pl[0];
38    for (i = 0; i < n; i++{
39        double s = cross(POINT(), pl[i], pl[i + 1]);
40        POINT t;
41        area += s;
42        t = pl[i] + pl[i + 1];
43        ct.x += s * t.x, ct.y += s * t.y;
44    }

45    ct.x = ct.x / area / 3.0, ct.y = ct.y / area / 3.0;
46    ct.print();
47}

48int main() {
49    int T = 1;
50    while (scanf("%d"&n) && n) {
51        printf("Stage #%d: ", T++);
52        solve();
53    }

54    return 0;
55}

56


yzhw 2010-10-14 17:58 鍙戣〃璇勮
]]>
偷窥少妇久久久久久久久| 99久久www免费人成精品| 久久久久精品国产亚洲AV无码| 99精品国产免费久久久久久下载 | 久久婷婷国产麻豆91天堂| 久久青草国产精品一区| 久久一本综合| 亚洲精品乱码久久久久久蜜桃不卡| 久久久久99精品成人片直播| 91久久精品国产免费直播| 欧美大战日韩91综合一区婷婷久久青草 | 狠狠狠色丁香婷婷综合久久五月| 91精品久久久久久无码| 无码人妻久久一区二区三区蜜桃| 色欲久久久天天天综合网| 久久久精品午夜免费不卡| 亚洲精品久久久www| 久久久国产精品亚洲一区| 久久精品亚洲精品国产欧美| 日韩AV无码久久一区二区| 久久久WWW成人免费毛片| 久久精品欧美日韩精品| 欧美麻豆久久久久久中文| 996久久国产精品线观看| 人妻无码久久精品| 久久美女人爽女人爽| 色综合久久久久无码专区| 亚洲国产精品狼友中文久久久 | 内射无码专区久久亚洲| 99久久国语露脸精品国产| 久久久久青草线蕉综合超碰| 国产成人无码精品久久久免费| 色狠狠久久AV五月综合| 一本久久a久久精品综合香蕉| 免费观看成人久久网免费观看| 精品熟女少妇AV免费久久| 久久精品无码一区二区app| 久久综合中文字幕| 久久AV高清无码| 久久人人爽人人爽人人片AV不| 久久亚洲国产成人影院|