﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-huicpc0860-随笔分类-Computational Geometry</title><link>http://www.cppblog.com/huicpc0860/category/13814.html</link><description>Everything has its history.</description><language>zh-cn</language><lastBuildDate>Tue, 10 Aug 2010 15:02:49 GMT</lastBuildDate><pubDate>Tue, 10 Aug 2010 15:02:49 GMT</pubDate><ttl>60</ttl><item><title>hdu 2993  MAX Average Problem</title><link>http://www.cppblog.com/huicpc0860/archive/2010/08/09/122835.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Mon, 09 Aug 2010 12:24:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/08/09/122835.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/122835.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/08/09/122835.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/122835.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/122835.html</trackback:ping><description><![CDATA[<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: #000000; ">#include&nbsp;</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">&gt;</span><span style="color: #000000; "><br></span><span style="color: #0000FF; ">using</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">namespace</span><span style="color: #000000; ">&nbsp;std;<br></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; ">&nbsp;N&nbsp;100010</span><span style="color: #000000; "><br></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; ">&nbsp;max(x,y)&nbsp;((x)&gt;(y)?(x):(y))</span><span style="color: #000000; "><br>typedef&nbsp;</span><span style="color: #0000FF; ">long</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">long</span><span style="color: #000000; ">&nbsp;&nbsp;LL;<br></span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;s[N];<br></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; ">&nbsp;point&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;x,&nbsp;y;<br>&nbsp;&nbsp;&nbsp;&nbsp;point(){}<br>&nbsp;&nbsp;&nbsp;&nbsp;point(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;x,</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;y):x(x),y(y){}<br>}p[N];<br>point&nbsp;</span><span style="color: #0000FF; ">operator</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">-</span><span style="color: #000000; ">&nbsp;(</span><span style="color: #0000FF; ">const</span><span style="color: #000000; ">&nbsp;point&nbsp;</span><span style="color: #000000; ">&amp;</span><span style="color: #000000; ">a,&nbsp;</span><span style="color: #0000FF; ">const</span><span style="color: #000000; ">&nbsp;point&nbsp;</span><span style="color: #000000; ">&amp;</span><span style="color: #000000; ">b)&nbsp;{&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;point(a.x</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.x,&nbsp;a.y</span><span style="color: #000000; ">-</span><span style="color: #000000; ">b.y);&nbsp;}<br>LL&nbsp;</span><span style="color: #0000FF; ">operator</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">^</span><span style="color: #000000; ">&nbsp;(</span><span style="color: #0000FF; ">const</span><span style="color: #000000; ">&nbsp;point&nbsp;</span><span style="color: #000000; ">&amp;</span><span style="color: #000000; ">a,&nbsp;</span><span style="color: #0000FF; ">const</span><span style="color: #000000; ">&nbsp;point&nbsp;</span><span style="color: #000000; ">&amp;</span><span style="color: #000000; ">b)&nbsp;{&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;(LL)a.x</span><span style="color: #000000; ">*</span><span style="color: #000000; ">b.y&nbsp;</span><span style="color: #000000; ">-</span><span style="color: #000000; ">&nbsp;(LL)a.y</span><span style="color: #000000; ">*</span><span style="color: #000000; ">b.x;&nbsp;}<br>inline&nbsp;</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">get</span><span style="color: #000000; ">(){<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;s</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">&nbsp;c;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(c</span><span style="color: #000000; ">=</span><span style="color: #000000; ">getchar(),c</span><span style="color: #000000; ">!=</span><span style="color: #000000; ">'</span><span style="color: #000000; ">&nbsp;</span><span style="color: #000000; ">'</span><span style="color: #000000; ">&amp;&amp;</span><span style="color: #000000; ">c</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; ">)s</span><span style="color: #000000; ">=</span><span style="color: #000000; ">s</span><span style="color: #000000; ">*</span><span style="color: #000000; ">10</span><span style="color: #000000; ">+</span><span style="color: #000000; ">c</span><span style="color: #000000; ">-</span><span style="color: #000000; ">'</span><span style="color: #000000; ">0</span><span style="color: #000000; ">'</span><span style="color: #000000; ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;s;<br>}<br></span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;main()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;n,k;<br>&nbsp;&nbsp;&nbsp;&nbsp;s[</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>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">&nbsp;(</span><span style="color: #000000; ">~</span><span style="color: #000000; ">scanf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d&nbsp;</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,</span><span style="color: #000000; ">&amp;</span><span style="color: #000000; ">n)){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">get</span><span style="color: #000000; ">();n</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;i</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">n;</span><span style="color: #000000; ">++</span><span style="color: #000000; ">i){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[i]</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">get</span><span style="color: #000000; ">();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s[i]</span><span style="color: #000000; ">+=</span><span style="color: #000000; ">s[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">&nbsp;ans</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">&nbsp;i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">k,m</span><span style="color: #000000; ">=-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">,f</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">n;</span><span style="color: #000000; ">++</span><span style="color: #000000; ">i){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;now(i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">k,s[i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">k]);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(f</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">m</span><span style="color: #000000; ">&amp;&amp;</span><span style="color: #000000; ">(p[m]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[m</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">]</span><span style="color: #000000; ">^</span><span style="color: #000000; ">now</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[m</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">])</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)</span><span style="color: #000000; ">--</span><span style="color: #000000; ">m;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;p[</span><span style="color: #000000; ">++</span><span style="color: #000000; ">m]</span><span style="color: #000000; ">=</span><span style="color: #000000; ">now;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(f</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">m</span><span style="color: #000000; ">&amp;&amp;</span><span style="color: #000000; ">(LL)(s[i]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f].y)</span><span style="color: #000000; ">*</span><span style="color: #000000; ">(i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f</span><span style="color: #000000; ">+</span><span style="color: #000000; ">1</span><span style="color: #000000; ">].x)</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">(LL)(s[i]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f</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; ">(i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f].x))f</span><span style="color: #000000; ">++</span><span style="color: #000000; ">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ans</span><span style="color: #000000; ">=</span><span style="color: #000000; ">max(ans,</span><span style="color: #0000FF; ">double</span><span style="color: #000000; ">(s[i]</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f].y)</span><span style="color: #000000; ">/</span><span style="color: #000000; ">(i</span><span style="color: #000000; ">-</span><span style="color: #000000; ">p[f].x));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%.2lf\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,ans);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}</span></div><img src ="http://www.cppblog.com/huicpc0860/aggbug/122835.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-08-09 20:24 <a href="http://www.cppblog.com/huicpc0860/archive/2010/08/09/122835.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>poj 1133 stars</title><link>http://www.cppblog.com/huicpc0860/archive/2010/08/01/121895.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Sun, 01 Aug 2010 12:05:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/08/01/121895.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/121895.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/08/01/121895.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/121895.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/121895.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: #include&nbsp;&lt;stdio.h&gt;#include&nbsp;&lt;math.h&gt;#include&nbsp;&lt;algorithm&gt;using&nbsp;namespace&nbsp;std;const&nbsp;double&nbsp;eps=1e-8;int&nbsp;so,mo,br;inline&nbsp;int&nbsp;dcmp(double...&nbsp;&nbsp;<a href='http://www.cppblog.com/huicpc0860/archive/2010/08/01/121895.html'>阅读全文</a><img src ="http://www.cppblog.com/huicpc0860/aggbug/121895.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-08-01 20:05 <a href="http://www.cppblog.com/huicpc0860/archive/2010/08/01/121895.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>poj 1271 Nice Milk</title><link>http://www.cppblog.com/huicpc0860/archive/2010/07/27/121412.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Tue, 27 Jul 2010 10:46:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/07/27/121412.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/121412.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/07/27/121412.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/121412.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/121412.html</trackback:ping><description><![CDATA[<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">math.h</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">algorithm</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;eps</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1e</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;h,ans,cake;<br><img id=Codehighlighter1_134_248_Open_Image onclick="this.style.display='none'; Codehighlighter1_134_248_Open_Text.style.display='none'; Codehighlighter1_134_248_Closed_Image.style.display='inline'; Codehighlighter1_134_248_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_134_248_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_134_248_Closed_Text.style.display='none'; Codehighlighter1_134_248_Open_Image.style.display='inline'; Codehighlighter1_134_248_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000">&nbsp;point&nbsp;</span><span id=Codehighlighter1_134_248_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_134_248_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x,y;<br><img id=Codehighlighter1_164_165_Open_Image onclick="this.style.display='none'; Codehighlighter1_164_165_Open_Text.style.display='none'; Codehighlighter1_164_165_Closed_Image.style.display='inline'; Codehighlighter1_164_165_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_164_165_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_164_165_Closed_Text.style.display='none'; Codehighlighter1_164_165_Open_Image.style.display='inline'; Codehighlighter1_164_165_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;()</span><span id=Codehighlighter1_164_165_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_164_165_Open_Text><span style="COLOR: #000000">{}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_206_207_Open_Image onclick="this.style.display='none'; Codehighlighter1_206_207_Open_Text.style.display='none'; Codehighlighter1_206_207_Closed_Image.style.display='inline'; Codehighlighter1_206_207_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_206_207_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_206_207_Closed_Text.style.display='none'; Codehighlighter1_206_207_Open_Image.style.display='inline'; Codehighlighter1_206_207_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x,</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;y):x(x),y(y)</span><span id=Codehighlighter1_206_207_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_206_207_Open_Text><span style="COLOR: #000000">{}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_223_246_Open_Image onclick="this.style.display='none'; Codehighlighter1_223_246_Open_Text.style.display='none'; Codehighlighter1_223_246_Closed_Image.style.display='inline'; Codehighlighter1_223_246_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_223_246_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_223_246_Closed_Text.style.display='none'; Codehighlighter1_223_246_Open_Image.style.display='inline'; Codehighlighter1_223_246_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">get</span><span style="COLOR: #000000">()</span><span id=Codehighlighter1_223_246_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_223_246_Open_Text><span style="COLOR: #000000">{scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%lf%lf</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">x,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">y);}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;<br><img id=Codehighlighter1_262_350_Open_Image onclick="this.style.display='none'; Codehighlighter1_262_350_Open_Text.style.display='none'; Codehighlighter1_262_350_Closed_Image.style.display='inline'; Codehighlighter1_262_350_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_262_350_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_262_350_Closed_Text.style.display='none'; Codehighlighter1_262_350_Open_Image.style.display='inline'; Codehighlighter1_262_350_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">struct</span><span style="COLOR: #000000">&nbsp;poly</span><span id=Codehighlighter1_262_350_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_262_350_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;p[</span><span style="COLOR: #000000">21</span><span style="COLOR: #000000">];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;n;<br><img id=Codehighlighter1_306_348_Open_Image onclick="this.style.display='none'; Codehighlighter1_306_348_Open_Text.style.display='none'; Codehighlighter1_306_348_Closed_Image.style.display='inline'; Codehighlighter1_306_348_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_306_348_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_306_348_Closed_Text.style.display='none'; Codehighlighter1_306_348_Open_Image.style.display='inline'; Codehighlighter1_306_348_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">get</span><span style="COLOR: #000000">()</span><span id=Codehighlighter1_306_348_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_306_348_Open_Text><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">&nbsp;i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)p[i].</span><span style="COLOR: #0000ff">get</span><span style="COLOR: #000000">();p[n]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">p[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">];}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">sg;<br><img id=Codehighlighter1_373_404_Open_Image onclick="this.style.display='none'; Codehighlighter1_373_404_Open_Text.style.display='none'; Codehighlighter1_373_404_Closed_Image.style.display='inline'; Codehighlighter1_373_404_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_373_404_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_373_404_Closed_Text.style.display='none'; Codehighlighter1_373_404_Open_Image.style.display='inline'; Codehighlighter1_373_404_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;dcmp(</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x)</span><span id=Codehighlighter1_373_404_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_373_404_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(x</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">eps)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(x</span><span style="COLOR: #000000">&lt;-</span><span style="COLOR: #000000">eps);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_443_497_Open_Image onclick="this.style.display='none'; Codehighlighter1_443_497_Open_Text.style.display='none'; Codehighlighter1_443_497_Closed_Image.style.display='inline'; Codehighlighter1_443_497_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_443_497_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_443_497_Closed_Text.style.display='none'; Codehighlighter1_443_497_Open_Image.style.display='inline'; Codehighlighter1_443_497_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;cross(point&nbsp;o,point&nbsp;p,point&nbsp;q)</span><span id=Codehighlighter1_443_497_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_443_497_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(p.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">o.x)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(q.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">o.y)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(p.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">o.y)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(q.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">o.x);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_547_650_Open_Image onclick="this.style.display='none'; Codehighlighter1_547_650_Open_Text.style.display='none'; Codehighlighter1_547_650_Closed_Image.style.display='inline'; Codehighlighter1_547_650_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_547_650_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_547_650_Closed_Text.style.display='none'; Codehighlighter1_547_650_Open_Image.style.display='inline'; Codehighlighter1_547_650_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top>point&nbsp;lineinter(point&nbsp;a,point&nbsp;b,point&nbsp;c,point&nbsp;d)</span><span id=Codehighlighter1_547_650_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_547_650_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;u</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">cross(a,b,c),v</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">cross(b,a,d);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;point((c.x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">v</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">d.x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">u)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(u</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">v),(c.y</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">v</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">d.y</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">u)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(u</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">v));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_679_739_Open_Image onclick="this.style.display='none'; Codehighlighter1_679_739_Open_Text.style.display='none'; Codehighlighter1_679_739_Closed_Image.style.display='inline'; Codehighlighter1_679_739_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_679_739_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_679_739_Closed_Text.style.display='none'; Codehighlighter1_679_739_Open_Image.style.display='inline'; Codehighlighter1_679_739_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;dis(point&nbsp;a,point&nbsp;b)</span><span id=Codehighlighter1_679_739_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_679_739_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;sqrt((a.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b.x)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(a.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b.x)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">(a.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b.y)</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(a.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b.y));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_785_892_Open_Image onclick="this.style.display='none'; Codehighlighter1_785_892_Open_Text.style.display='none'; Codehighlighter1_785_892_Closed_Image.style.display='inline'; Codehighlighter1_785_892_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_785_892_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_785_892_Closed_Text.style.display='none'; Codehighlighter1_785_892_Open_Image.style.display='inline'; Codehighlighter1_785_892_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;push(point&nbsp;a,point&nbsp;b,point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">c,point&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">d)</span><span id=Codehighlighter1_785_892_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_785_892_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">a.y</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b.y,y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">b.x</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">a.x,t</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">h</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">dis(a,b);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;c</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">point(a.x</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">t,a.y</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">t);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;d</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">point(b.x</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">t,b.y</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">t);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_935_1191_Open_Image onclick="this.style.display='none'; Codehighlighter1_935_1191_Open_Text.style.display='none'; Codehighlighter1_935_1191_Closed_Image.style.display='inline'; Codehighlighter1_935_1191_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_935_1191_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_935_1191_Closed_Text.style.display='none'; Codehighlighter1_935_1191_Open_Image.style.display='inline'; Codehighlighter1_935_1191_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;cut(point&nbsp;a,point&nbsp;b,poly&nbsp;tg,poly&nbsp;</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">g)</span><span id=Codehighlighter1_935_1191_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_935_1191_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;push(a,b,a,b);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;g.n</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img id=Codehighlighter1_994_1168_Open_Image onclick="this.style.display='none'; Codehighlighter1_994_1168_Open_Text.style.display='none'; Codehighlighter1_994_1168_Closed_Image.style.display='inline'; Codehighlighter1_994_1168_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_994_1168_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_994_1168_Closed_Text.style.display='none'; Codehighlighter1_994_1168_Open_Image.style.display='inline'; Codehighlighter1_994_1168_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">tg.n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)</span><span id=Codehighlighter1_994_1168_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_994_1168_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;u</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">dcmp(cross(a,b,tg.p[i])),v</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">dcmp(cross(a,b,tg.p[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(u</span><span style="COLOR: #000000">&gt;=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)g.p[g.n</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">tg.p[i];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(u</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">v</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)&nbsp;g.p[g.n</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">lineinter(a,b,tg.p[i],tg.p[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;g.p[g.n]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">g.p[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">];<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_1212_1323_Open_Image onclick="this.style.display='none'; Codehighlighter1_1212_1323_Open_Text.style.display='none'; Codehighlighter1_1212_1323_Closed_Image.style.display='inline'; Codehighlighter1_1212_1323_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1212_1323_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1212_1323_Closed_Text.style.display='none'; Codehighlighter1_1212_1323_Open_Image.style.display='inline'; Codehighlighter1_1212_1323_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;area(poly&nbsp;g)</span><span id=Codehighlighter1_1212_1323_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1212_1323_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000">&nbsp;sum</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">g.n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sum</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">cross(g.p[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">],g.p[i</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">],g.p[i]);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0.5</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">sum;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_1356_1496_Open_Image onclick="this.style.display='none'; Codehighlighter1_1356_1496_Open_Text.style.display='none'; Codehighlighter1_1356_1496_Closed_Image.style.display='inline'; Codehighlighter1_1356_1496_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1356_1496_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1356_1496_Closed_Text.style.display='none'; Codehighlighter1_1356_1496_Open_Image.style.display='inline'; Codehighlighter1_1356_1496_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;dfs(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;step,poly&nbsp;g)</span><span id=Codehighlighter1_1356_1496_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1356_1496_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(step</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">sg.n)dfs(i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,step,g);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;cut(sg.p[i],sg.p[i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">],g,g);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(step</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)ans</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">max(ans,cake</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">area(g));<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">&nbsp;dfs(i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,step</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,g);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img id=Codehighlighter1_1508_1733_Open_Image onclick="this.style.display='none'; Codehighlighter1_1508_1733_Open_Text.style.display='none'; Codehighlighter1_1508_1733_Closed_Image.style.display='inline'; Codehighlighter1_1508_1733_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_1508_1733_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1508_1733_Closed_Text.style.display='none'; Codehighlighter1_1508_1733_Open_Image.style.display='inline'; Codehighlighter1_1508_1733_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;main()</span><span id=Codehighlighter1_1508_1733_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1508_1733_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;k;<br><img id=Codehighlighter1_1571_1717_Open_Image onclick="this.style.display='none'; Codehighlighter1_1571_1717_Open_Text.style.display='none'; Codehighlighter1_1571_1717_Closed_Image.style.display='inline'; Codehighlighter1_1571_1717_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_1571_1717_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1571_1717_Closed_Text.style.display='none'; Codehighlighter1_1571_1717_Open_Image.style.display='inline'; Codehighlighter1_1571_1717_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d%d%lf</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">sg.n,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">k,</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">h),sg.n</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">k</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">h)</span><span id=Codehighlighter1_1571_1717_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_1571_1717_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sg.</span><span style="COLOR: #0000ff">get</span><span style="COLOR: #000000">();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cake</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">area(sg);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ans</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">min(k,sg.n);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">h)dfs(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,k,sg);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%.2lf\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,ans);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
<img src ="http://www.cppblog.com/huicpc0860/aggbug/121412.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-07-27 18:46 <a href="http://www.cppblog.com/huicpc0860/archive/2010/07/27/121412.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>poj 3347 Kadj Squares</title><link>http://www.cppblog.com/huicpc0860/archive/2010/07/23/121134.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Fri, 23 Jul 2010 10:51:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/07/23/121134.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/121134.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/07/23/121134.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/121134.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/121134.html</trackback:ping><description><![CDATA[<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">stdio.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">math.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;max(a,b)&nbsp;(a&gt;b?a:b)</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;n;<br><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;">&nbsp;seg&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">double</span><span style="color: #000000;">&nbsp;l,&nbsp;r,&nbsp;t;<br>}&nbsp;a[</span><span style="color: #000000;">50</span><span style="color: #000000;">];<br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;main()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">while</span><span style="color: #000000;">&nbsp;(scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">n),&nbsp;n)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%lf</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">a[i].t);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[i].l&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0.0</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;j&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;j&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;i;&nbsp;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[i].l&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;max(a[i].l,&nbsp;a[j].r&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;fabs(a[i].t&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;a[j].t)&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[i].r&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;a[i].l&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;a[i].t;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;j&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;j&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;i;&nbsp;j</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(a[i].l&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;a[i].r)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(a[i].t&nbsp;</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;a[j].t&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;a[i].l&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;a[j].r)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[j].r&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;a[i].l;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">else</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(a[i].t&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;a[j].t&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;a[j].r&nbsp;</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;a[i].l)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a[i].l&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;a[j].r;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(a[i].l&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;a[i].r)printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;i&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts(</span><span style="color: #000000;">""</span><span style="color: #000000;">);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}</span></div>
<br><img src ="http://www.cppblog.com/huicpc0860/aggbug/121134.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-07-23 18:51 <a href="http://www.cppblog.com/huicpc0860/archive/2010/07/23/121134.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hdu 3437 Garden</title><link>http://www.cppblog.com/huicpc0860/archive/2010/07/14/120383.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Wed, 14 Jul 2010 13:39:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/07/14/120383.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/120383.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/07/14/120383.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/120383.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/120383.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: #include&nbsp;&lt;stdio.h&gt;#include&nbsp;&lt;algorithm&gt;#include&nbsp;&lt;math.h&gt;#define&nbsp;zero(x)&nbsp;if(dcmp(x)==0)x=0#define&nbsp;cross(p0,p1,p2)&nbsp;((p1.x-p0.x)*(p2.y-p0.y)-(p1.y-p0.y...&nbsp;&nbsp;<a href='http://www.cppblog.com/huicpc0860/archive/2010/07/14/120383.html'>阅读全文</a><img src ="http://www.cppblog.com/huicpc0860/aggbug/120383.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-07-14 21:39 <a href="http://www.cppblog.com/huicpc0860/archive/2010/07/14/120383.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>poj 1228 Grandpa's Estate</title><link>http://www.cppblog.com/huicpc0860/archive/2010/05/15/115468.html</link><dc:creator>huicpc0860</dc:creator><author>huicpc0860</author><pubDate>Sat, 15 May 2010 13:07:00 GMT</pubDate><guid>http://www.cppblog.com/huicpc0860/archive/2010/05/15/115468.html</guid><wfw:comment>http://www.cppblog.com/huicpc0860/comments/115468.html</wfw:comment><comments>http://www.cppblog.com/huicpc0860/archive/2010/05/15/115468.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huicpc0860/comments/commentRss/115468.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huicpc0860/services/trackbacks/115468.html</trackback:ping><description><![CDATA[<div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">stdio.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">algorithm</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">namespace</span><span style="color: #000000;">&nbsp;std;<br><br></span><span style="color: #0000ff;">struct</span><span style="color: #000000;">&nbsp;point&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;x,&nbsp;y;<br>};<br><br></span><span style="color: #0000ff;">bool</span><span style="color: #000000;">&nbsp;cmp(point&nbsp;p1,&nbsp;point&nbsp;p2)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;p1.y&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;p2.y&nbsp;</span><span style="color: #000000;">||</span><span style="color: #000000;">&nbsp;p1.y&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;p2.y&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;p1.x&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;p2.x;<br>}<br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;cross(point&nbsp;p0,&nbsp;point&nbsp;p1,&nbsp;point&nbsp;p2)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;(p1.x&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;p0.x)</span><span style="color: #000000;">*</span><span style="color: #000000;">(p2.y&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;p0.y)</span><span style="color: #000000;">-</span><span style="color: #000000;">(p1.y&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;p0.y)</span><span style="color: #000000;">*</span><span style="color: #000000;">(p2.x&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;p0.x);<br>}<br><br></span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;tubao(point&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">p,&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;n,&nbsp;point&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">ch,&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">m)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i,&nbsp;k;<br>&nbsp;&nbsp;&nbsp;&nbsp;sort(p,&nbsp;p&nbsp;</span><span style="color: #000000;">+</span><span style="color: #000000;">&nbsp;n,&nbsp;cmp);<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(m&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">while</span><span style="color: #000000;">&nbsp;(m&nbsp;</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;cross(ch[m&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">],&nbsp;ch[m&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">],&nbsp;p[i])&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">)m</span><span style="color: #000000;">--</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ch[m</span><span style="color: #000000;">++</span><span style="color: #000000;">]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;p[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(n&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;m)</span><span style="color: #0000ff;">return</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;k&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;m;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;n&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&gt;=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i</span><span style="color: #000000;">--</span><span style="color: #000000;">)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">while</span><span style="color: #000000;">&nbsp;(m&nbsp;</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;k&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;cross(ch[m&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">],&nbsp;ch[m&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">],&nbsp;p[i])&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">)m</span><span style="color: #000000;">--</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ch[m</span><span style="color: #000000;">++</span><span style="color: #000000;">]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;p[i];<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(n&nbsp;</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">)m</span><span style="color: #000000;">--</span><span style="color: #000000;">;<br>}<br><br></span><span style="color: #0000ff;">bool</span><span style="color: #000000;">&nbsp;judge(point&nbsp;</span><span style="color: #000000;">*</span><span style="color: #000000;">p,&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;n)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(n&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">6</span><span style="color: #000000;">)</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(cross(p[</span><span style="color: #000000;">0</span><span style="color: #000000;">],&nbsp;p[</span><span style="color: #000000;">1</span><span style="color: #000000;">],&nbsp;p[i])&nbsp;</span><span style="color: #000000;">!=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">)</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>}<br><br></span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;main()&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;p[</span><span style="color: #000000;">1010</span><span style="color: #000000;">],&nbsp;ch[</span><span style="color: #000000;">1010</span><span style="color: #000000;">];<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;t,&nbsp;n;<br>&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">t);<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">while</span><span style="color: #000000;">&nbsp;(t</span><span style="color: #000000;">--</span><span style="color: #000000;">)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">n);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scanf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d%d</span><span style="color: #000000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">p[i].x,&nbsp;</span><span style="color: #000000;">&amp;</span><span style="color: #000000;">p[i].y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">bool</span><span style="color: #000000;">&nbsp;flag&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;judge(p,&nbsp;n);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(flag)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tubao(p,&nbsp;n,&nbsp;ch,&nbsp;n);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ch[n]&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ch[</span><span style="color: #000000;">0</span><span style="color: #000000;">];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;point&nbsp;a,&nbsp;b;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">;&nbsp;flag&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">&nbsp;n;)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ch[i&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">],&nbsp;b&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ch[i</span><span style="color: #000000;">++</span><span style="color: #000000;">];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">while</span><span style="color: #000000;">&nbsp;(i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;n&nbsp;</span><span style="color: #000000;">&amp;&amp;</span><span style="color: #000000;">&nbsp;cross(a,&nbsp;b,&nbsp;ch[i])&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flag&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts(flag&nbsp;</span><span style="color: #000000;">?</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">YES</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">NO</span><span style="color: #000000;">"</span><span style="color: #000000;">);<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br>}</span></div>
<br>  <img src ="http://www.cppblog.com/huicpc0860/aggbug/115468.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huicpc0860/" target="_blank">huicpc0860</a> 2010-05-15 21:07 <a href="http://www.cppblog.com/huicpc0860/archive/2010/05/15/115468.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>