<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>NOT A BLOG &#124; sqybi</title>
	<link>http://sqybi.72pines.com</link>
	<description>This is not (only) a blog.</description>
	<pubDate>Fri, 25 Jul 2008 13:43:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
	<language>en</language>
			<item>
		<title>FIGHT</title>
		<link>http://sqybi.72pines.com/posts/90</link>
		<comments>http://sqybi.72pines.com/posts/90#comments</comments>
		<pubDate>Fri, 25 Jul 2008 13:43:01 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[BLOG &amp; ME]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/90</guid>
		<description><![CDATA[全国信息学奥林匹克竞赛.NOI.明晚出发.Fight.明天起网上与sqybi有关的地方不会再更新,联系我请短信(短信-&#62;Short Message-&#62;SM,也就是说请SM我).新的S60手机很爽.
李冠儒.杨欢.王蕊.赵灿辉.魏恩勋.邹蒙川.金林.王东岳.蔡育琛.大家都加油.当然 还有我自己
这届天津队不被看好 但这又怎样 努力了就好.
我们在天上的父 愿你的国降临愿你的旨意行在地上如同行在天上我们日用的饮食今日赐给我们不叫我们面对试探 救我们脱离凶恶因为 国度 权柄 荣耀 都是你的直到 永远阿门
阅读(28 次)]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/90/feed</wfw:commentRss>
		</item>
		<item>
		<title>POJ 1990 &#8212; MooFest</title>
		<link>http://sqybi.72pines.com/posts/89</link>
		<comments>http://sqybi.72pines.com/posts/89#comments</comments>
		<pubDate>Mon, 21 Jul 2008 10:56:16 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[POJ]]></category>

		<category><![CDATA[树状数组]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/89</guid>
		<description><![CDATA[好久没大更新了,把最近做的一些题的题解发上来.
_gXX  19:27:46
一群奶牛 = =
_gXX  19:27:51
排成一排
_gXX  19:28:07
但是有点耳聋 = = 所以每个牛都有个听力值
_gXX  19:28:22
他们互相说话的花费就是两个牛的听力值的较大值*距离 = =
_gXX  19:28:29
现在所有牛都要互相说话
_gXX  19:28:31
问 = =
_gXX  19:28:35
要耗费多少啦&#8230;
题意大概就是这样,听力值解释为耳聋值更合理一些&#8230;
然后呢,按照耳聋值排序,依次处理每一个奶牛.对于排序后的奶牛i,它与1~i-1说话时,较大的一定是i的听力值.这样只需要用i的听力值乘以i与1~i-1所有奶牛的距离和就可以.维护距离可以用树状数组两个,其中一个维护每个坐标上有多少个奶牛,另一个则是存储每个坐标上奶牛个数和坐标值的乘积.
发现我写这东西写得让人看不懂了555&#8230;看程序吧.
{
POJ 1990; MooFest
- sqybi&#8217;s code
- 树状数组
}
//for my winsty
program pku1990_sqybi;
  const
    nn = 20000;
    xx = 20000; 
  type
    TTreeArray = object
      a: array[1..xx]of int64;
      procedure init;
      function lowbit(x: longint): longint;
      procedure add(x, y: longint);
      function sum(x: longint): int64;
    end;
    [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/89/feed</wfw:commentRss>
		</item>
		<item>
		<title>TOI 1125 &#8212; 搬石头</title>
		<link>http://sqybi.72pines.com/posts/88</link>
		<comments>http://sqybi.72pines.com/posts/88#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:25:45 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[TOI]]></category>

		<category><![CDATA[计算几何]]></category>

		<category><![CDATA[重心]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/88</guid>
		<description><![CDATA[给定一个多边形,求重心.其实只需要随便找一个点,然后围绕它分割成若干个三角形.三角形的重心可以用三顶点坐标的平均数表示,然后重心的权值就是三角形的有向面积.最后对重心坐标加权求平均数就行.不用管多边形是顺时针还是逆时针给出,也不用管是凸还是凹.
一定要记得,输出的时候加上一个eps!不然会有-0.00的诡异错误!我就是不听RoBa话输出时没加eps导致三个点WA掉&#8230;
{ TOI 1125; 搬石头 - sqybi&#8217;s code - 求多边形重心}//for my winstyprogram toi1125_sqybi;&#160; const&#160;&#160;&#160; fin = &#8217;stone.in&#8217;;&#160;&#160;&#160; fout = &#8217;stone.out&#8217;;&#160;&#160;&#160; nn = 1000000;&#160;&#160;&#160; eps = 1e-6; 
&#160; var&#160;&#160;&#160; n, i: longint;&#160;&#160;&#160; a, b: array[1..nn]of record&#160;&#160;&#160;&#160;&#160; x, y: double;&#160;&#160;&#160; end;&#160;&#160;&#160; c: array[1..nn]of double;&#160;&#160;&#160; totx, toty, totn: double; 
&#160; function crossMult(x1, y1, x2, y2: double): double;&#160;&#160;&#160; begin&#160;&#160;&#160;&#160;&#160; crossMult [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/88/feed</wfw:commentRss>
		</item>
		<item>
		<title>TOI 1149 &#8212; 城堡围墙</title>
		<link>http://sqybi.72pines.com/posts/87</link>
		<comments>http://sqybi.72pines.com/posts/87#comments</comments>
		<pubDate>Sun, 13 Jul 2008 08:51:56 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[TOI]]></category>

		<category><![CDATA[凸包]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/87</guid>
		<description><![CDATA[这里好久没更新了,因为没做什么太好的题.最近做题太少,这几天要开始努力做题了.
可以发现把城堡边界的凸包平移之后,多出来的拐角部分都是圆弧,而这些圆弧恰好可以组成一个圆.所以这道题的答案是凸包的周长+2*pi*l.第一次写凸包,发现没有想象的那么恶心,反而是异常好写.代码写得不好看,大牛忽略即可.
{ TOI 1149; 城堡围墙 - sqybi&#8217;s code - 凸包}//for my winstyprogram toi1149_sqybi;&#160; const&#160;&#160;&#160; fin = &#8216;wall.in&#8217;;&#160;&#160;&#160; fout = &#8216;wall.out&#8217;;&#160;&#160;&#160; nn = 1000;&#160;&#160;&#160; esp = 1e-6; 
&#160; type&#160;&#160;&#160; rec = record&#160;&#160;&#160;&#160;&#160; x, y: double;&#160;&#160;&#160; end; 
&#160; var&#160;&#160;&#160; n, i, sl1, sl2: longint;&#160;&#160;&#160; l, res: double;&#160;&#160;&#160; stack1, stack2: array[1..nn]of longint;&#160;&#160;&#160; a: array[1..nn]of rec; 
&#160; function comp(a, b: [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/87/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 180 &#8212; Inversions</title>
		<link>http://sqybi.72pines.com/posts/86</link>
		<comments>http://sqybi.72pines.com/posts/86#comments</comments>
		<pubDate>Tue, 24 Jun 2008 13:36:29 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[SGU]]></category>

		<category><![CDATA[归并排序]]></category>

		<category><![CDATA[树状数组]]></category>

		<category><![CDATA[逆序对]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/86</guid>
		<description><![CDATA[求逆序对个数,很经典了.可以归并排序求,可我不喜欢归并,所以我的做法是离散化之后用树状数组维护一下.复杂度一样,离散化也不是很难写,树状数组也巨简单.强烈推荐.
这题极其bt的是,答案是int64的&#8230;用longint存答案就WA on 14(还是12?)&#8230;
{ SGU 180; Inversions - sqybi&#8217;s code - 逆序对}//for my winstyprogram sgu180_sqybi;&#160; const&#160;&#160;&#160; nn = 65537; 
&#160; type&#160;&#160;&#160; rec = record&#160;&#160;&#160;&#160;&#160; v, p: longint;&#160;&#160;&#160; end; 
&#160; var&#160;&#160;&#160; n, i, t, r: longint;&#160;&#160;&#160; s: int64;&#160;&#160;&#160; a: array[1..nn]of rec;&#160;&#160;&#160; b, c: array[1..nn]of longint; 
&#160; procedure qsort(l, r: longint);&#160;&#160;&#160; var&#160;&#160;&#160;&#160;&#160; i, j, d: longint;&#160;&#160;&#160;&#160;&#160; t: rec;&#160;&#160;&#160; [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/86/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 117 &#8212; Counting</title>
		<link>http://sqybi.72pines.com/posts/84</link>
		<comments>http://sqybi.72pines.com/posts/84#comments</comments>
		<pubDate>Tue, 10 Jun 2008 05:30:47 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[SGU]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/84</guid>
		<description><![CDATA[给出n个数,判断它们的m次方能不能被k整除.对每个数和k分解质因数即可(注意对于每个数只需要分解k的因子).
{ SGU 117; Counting - sqybi&#8217;s code}//for my winstyprogram sgu117_sqybi;&#160; const&#160;&#160;&#160; nn = 10000; 
&#160; var&#160;&#160;&#160; i, j, k, kk, l, n, m, s, t: longint;&#160;&#160;&#160; a, b, p: array[1..nn]of longint;&#160;&#160;&#160; f: boolean; 
&#160; begin&#160;&#160;&#160; readln(n, m, k);&#160;&#160;&#160; kk := k;&#160;&#160;&#160; l := 0;&#160;&#160;&#160; for i:=2 to kk do begin&#160;&#160;&#160;&#160;&#160; if k = 1 then [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/84/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 113 &#8212; Nearly prime numbers</title>
		<link>http://sqybi.72pines.com/posts/83</link>
		<comments>http://sqybi.72pines.com/posts/83#comments</comments>
		<pubDate>Tue, 10 Jun 2008 05:25:25 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[未分类]]></category>

		<category><![CDATA[SGU]]></category>

		<category><![CDATA[素数]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/83</guid>
		<description><![CDATA[枚举一个素因子i,再判断n div i是不是素数就可以.数据太水了,我刚开始的程序有bug,枚举的不是素因子而是任意因子&#8230;我shaz&#8230;把自己的算法给忘了&#8230;刚才看了一下,枚举到的第一个因子一定是素因子(除了1最小的因子啊&#8230;),而只对这一个因子进行判断就可以&#8230;不用筛法,朴素判素就能AC.
{ SGU 113; Nearly prime numbers - sqybi&#8217;s code}//for my winstyprogram sgu113_sqybi;&#160; var&#160;&#160;&#160; f: boolean;&#160;&#160;&#160; i, times, cases, n: longint; 
&#160; function prime(x: longint): boolean;&#160;&#160;&#160; var&#160;&#160;&#160;&#160;&#160; i: longint;&#160;&#160;&#160; begin&#160;&#160;&#160;&#160;&#160; prime := false;&#160;&#160;&#160;&#160;&#160; for i:=2 to trunc(sqrt(x)) do&#160;&#160;&#160;&#160;&#160;&#160;&#160; if x mod i = 0 then exit;&#160;&#160;&#160;&#160;&#160; prime := true;&#160;&#160;&#160; end; 
&#160; begin&#160;&#160;&#160; readln(cases);&#160;&#160;&#160; for [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/83/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 107 &#8212; 987654321 problem</title>
		<link>http://sqybi.72pines.com/posts/82</link>
		<comments>http://sqybi.72pines.com/posts/82#comments</comments>
		<pubDate>Tue, 10 Jun 2008 05:17:48 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[SGU]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/82</guid>
		<description><![CDATA[可以发现,一个数平方的最后9位只和这个数的最后9位有关.对1~9位数随便写个小程序枚举一下,就可发现:对于1位数到8位数,没有任何符合条件;对于9位数,有8个数符合条件;对于n位数(n&#62;9),最高位有9种(1~9),后9位有8种,剩余n-10位每位10种(0~9),总共72*10^(n-10)种.
{SGU 107; 987654321 Problem- sqybi&#8217;s code}//for my winstyprogram sgu107_sqybi;&#160; var&#160;&#160;&#160; i, n: longint; 
&#160; begin&#160;&#160;&#160; readln(n);&#160;&#160;&#160; if n &#60;= 8 then&#160;&#160;&#160;&#160;&#160; writeln(0)&#160;&#160;&#160; else if n = 9 then&#160;&#160;&#160;&#160;&#160; writeln(8)&#160;&#160;&#160; else begin&#160;&#160;&#160;&#160;&#160; write(72);&#160;&#160;&#160;&#160;&#160; for i:=1 to n-10 do write(0);&#160;&#160;&#160; end;&#160; end.
阅读(60 次)]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/82/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 179 &#8212; Brackets light</title>
		<link>http://sqybi.72pines.com/posts/81</link>
		<comments>http://sqybi.72pines.com/posts/81#comments</comments>
		<pubDate>Sun, 08 Jun 2008 13:28:16 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[SGU]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/81</guid>
		<description><![CDATA[找到最靠后的一个满足它左边的&#8217;('比&#8217;)'数量多的&#8217;(',改成&#8217;)',然后在后面补(&#8230;()&#8230;)和)&#8230;).好久以前就写过的题.刚才写错了一点,在最后填括号的时候先填(&#8230;()&#8230;),再填)&#8230;).
{ SGU 179; Brackets light - sqybi&#8217;s code}//for my winstyprogram sgu179_sqybi;&#160; var&#160;&#160;&#160; i, l, r, tr, t: longint;&#160;&#160;&#160; s: ansistring; 
&#160; begin&#160;&#160;&#160; readln(s);&#160;&#160;&#160; l := length(s);&#160;&#160;&#160; t := 0;&#160;&#160;&#160; r := 0;&#160;&#160;&#160; for i:=1 to l do begin&#160;&#160;&#160;&#160;&#160; if (t &#62; 0) and (s[i] = &#8216;(&#8217;) then begin&#160;&#160;&#160;&#160;&#160;&#160;&#160; tr := t;&#160;&#160;&#160;&#160;&#160;&#160;&#160; r := i;&#160;&#160;&#160;&#160;&#160; end;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/81/feed</wfw:commentRss>
		</item>
		<item>
		<title>SGU 172 &#8212; eXam</title>
		<link>http://sqybi.72pines.com/posts/80</link>
		<comments>http://sqybi.72pines.com/posts/80#comments</comments>
		<pubDate>Tue, 27 May 2008 13:09:39 +0000</pubDate>
		<dc:creator>sqybi</dc:creator>
		
		<category><![CDATA[SGU]]></category>

		<category><![CDATA[DFS]]></category>

		<category><![CDATA[并查集]]></category>

		<guid isPermaLink="false">http://sqybi.72pines.com/posts/80</guid>
		<description><![CDATA[这道题WindyWinter牛给出的算法是并查集,实际上可以DFS解决(感谢alft&#8230;).
每个人选的两个课程之间连无向边,然后DFS时进行黑白染色,DFS树上每个结点和他的父亲节点不同色.然后考虑横向边和返祖边,如果有一条边两边的结点颜色相同则说明无解,否则将白色的考试放在一天,黑色的放在另一天就可以了&#8230;并查集当然也没错&#8230;
注意会是一个森林,需要多次DFS&#8230;
{ SGU 172; eXam - sqybi&#8217;s code - DFS}//for my winstyprogram sgu172_sqybi;&#160; const&#160;&#160;&#160; nn = 200;&#160;&#160;&#160; mm = 30000; 
&#160; var&#160;&#160;&#160; n, m, tot, i, x, y, t: longint;&#160;&#160;&#160; flag: boolean;&#160;&#160;&#160; head, p: array[1..nn]of longint;&#160;&#160;&#160; adj, next: array[-mm..mm]of longint; 
&#160; procedure addEdge(x, y: longint);&#160;&#160;&#160; begin&#160;&#160;&#160;&#160;&#160; inc(tot);&#160;&#160;&#160;&#160;&#160; adj[tot] := y;&#160;&#160;&#160;&#160;&#160; next[tot] := head[x];&#160;&#160;&#160;&#160;&#160; head[x] := tot;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
		<wfw:commentRss>http://sqybi.72pines.com/posts/80/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
