<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/feedsky6.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/notablog" type="application/rss+xml" ref="self"></atom:link><fs:self_link href="http://feed.feedsky.com/notablog" type="application/rss+xml"></fs:self_link><lastBuildDate>Tue, 24 Jun 2008 13:36:29 GMT</lastBuildDate><title>NOT A BLOG | sqybi</title><description>This is not only a blog.</description><link>http://sqybi.72pines.com</link><language>en</language><pubDate>Tue, 24 Jun 2008 13:36:29 GMT</pubDate><dc:date>2008-06-24T13:36:29Z</dc:date><dc:language>en</dc:language><item><title>SGU 180 — Inversions</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253217/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/86/feed</wfw:commentRss><description>求逆序对个数,很经典了.可以归并排序求,可我不喜欢归并,所以我的做法是离散化之后用树状数组维护一下.复杂度一样,离散化也不是很难写,树状数组也巨简单.强烈推荐.
这题极其bt的是,答案是int64的&amp;#8230;用longint存答案就WA on 14(还是12?)&amp;#8230;
{ SGU 180; Inversions - sqybi&amp;#8217;s code - 逆序对}//for my winstyprogram sgu180_sqybi;&amp;#160; const&amp;#160;&amp;#160;&amp;#160; nn = 65537; 
&amp;#160; type&amp;#160;&amp;#160;&amp;#160; rec = record&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; v, p: longint;&amp;#160;&amp;#160;&amp;#160; end; 
&amp;#160; var&amp;#160;&amp;#160;&amp;#160; n, i, t, r: longint;&amp;#160;&amp;#160;&amp;#160; s: int64;&amp;#160;&amp;#160;&amp;#160; a: array[1..nn]of rec;&amp;#160;&amp;#160;&amp;#160; b, c: array[1..nn]of longint; 
&amp;#160; procedure qsort(l, r: longint);&amp;#160;&amp;#160;&amp;#160; var&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i, j, d: longint;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; t: rec;&amp;#160;&amp;#160;&amp;#160; [...]</description><category>归并排序</category><category>SGU</category><category>树状数组</category><category>逆序对</category><pubDate>Tue, 24 Jun 2008 21:36:29 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/86#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/86</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/86</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253217/5058046</fs:itemid></item><item><title>SGU 117 — Counting</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253218/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/84/feed</wfw:commentRss><description>给出n个数,判断它们的m次方能不能被k整除.对每个数和k分解质因数即可(注意对于每个数只需要分解k的因子).
{ SGU 117; Counting - sqybi&amp;#8217;s code}//for my winstyprogram sgu117_sqybi;&amp;#160; const&amp;#160;&amp;#160;&amp;#160; nn = 10000; 
&amp;#160; var&amp;#160;&amp;#160;&amp;#160; i, j, k, kk, l, n, m, s, t: longint;&amp;#160;&amp;#160;&amp;#160; a, b, p: array[1..nn]of longint;&amp;#160;&amp;#160;&amp;#160; f: boolean; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(n, m, k);&amp;#160;&amp;#160;&amp;#160; kk := k;&amp;#160;&amp;#160;&amp;#160; l := 0;&amp;#160;&amp;#160;&amp;#160; for i:=2 to kk do begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if k = 1 then [...]</description><category>SGU</category><pubDate>Tue, 10 Jun 2008 13:30:47 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/84#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/84</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/84</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253218/5058046</fs:itemid></item><item><title>SGU 113 — Nearly prime numbers</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253219/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/83/feed</wfw:commentRss><description>枚举一个素因子i,再判断n div i是不是素数就可以.数据太水了,我刚开始的程序有bug,枚举的不是素因子而是任意因子&amp;#8230;我shaz&amp;#8230;把自己的算法给忘了&amp;#8230;刚才看了一下,枚举到的第一个因子一定是素因子(除了1最小的因子啊&amp;#8230;),而只对这一个因子进行判断就可以&amp;#8230;不用筛法,朴素判素就能AC.
{ SGU 113; Nearly prime numbers - sqybi&amp;#8217;s code}//for my winstyprogram sgu113_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; f: boolean;&amp;#160;&amp;#160;&amp;#160; i, times, cases, n: longint; 
&amp;#160; function prime(x: longint): boolean;&amp;#160;&amp;#160;&amp;#160; var&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i: longint;&amp;#160;&amp;#160;&amp;#160; begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; prime := false;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; for i:=2 to trunc(sqrt(x)) do&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if x mod i = 0 then exit;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; prime := true;&amp;#160;&amp;#160;&amp;#160; end; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(cases);&amp;#160;&amp;#160;&amp;#160; for [...]</description><category>素数</category><category>SGU</category><category>未分类</category><pubDate>Tue, 10 Jun 2008 13:25:25 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/83#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/83</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/83</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253219/5058046</fs:itemid></item><item><title>SGU 107 — 987654321 problem</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253220/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/82/feed</wfw:commentRss><description>可以发现,一个数平方的最后9位只和这个数的最后9位有关.对1~9位数随便写个小程序枚举一下,就可发现:对于1位数到8位数,没有任何符合条件;对于9位数,有8个数符合条件;对于n位数(n&amp;#62;9),最高位有9种(1~9),后9位有8种,剩余n-10位每位10种(0~9),总共72*10^(n-10)种.
{SGU 107; 987654321 Problem- sqybi&amp;#8217;s code}//for my winstyprogram sgu107_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; i, n: longint; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(n);&amp;#160;&amp;#160;&amp;#160; if n &amp;#60;= 8 then&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeln(0)&amp;#160;&amp;#160;&amp;#160; else if n = 9 then&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeln(8)&amp;#160;&amp;#160;&amp;#160; else begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; write(72);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; for i:=1 to n-10 do write(0);&amp;#160;&amp;#160;&amp;#160; end;&amp;#160; end.
阅读(21 次)</description><category>SGU</category><pubDate>Tue, 10 Jun 2008 13:17:48 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/82#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/82</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/82</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253220/5058046</fs:itemid></item><item><title>SGU 179 — Brackets light</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253221/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/81/feed</wfw:commentRss><description>找到最靠后的一个满足它左边的&amp;#8217;('比&amp;#8217;)'数量多的&amp;#8217;(',改成&amp;#8217;)',然后在后面补(&amp;#8230;()&amp;#8230;)和)&amp;#8230;).好久以前就写过的题.刚才写错了一点,在最后填括号的时候先填(&amp;#8230;()&amp;#8230;),再填)&amp;#8230;).
{ SGU 179; Brackets light - sqybi&amp;#8217;s code}//for my winstyprogram sgu179_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; i, l, r, tr, t: longint;&amp;#160;&amp;#160;&amp;#160; s: ansistring; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(s);&amp;#160;&amp;#160;&amp;#160; l := length(s);&amp;#160;&amp;#160;&amp;#160; t := 0;&amp;#160;&amp;#160;&amp;#160; r := 0;&amp;#160;&amp;#160;&amp;#160; for i:=1 to l do begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (t &amp;#62; 0) and (s[i] = &amp;#8216;(&amp;#8217;) then begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; tr := t;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; r := i;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; end;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [...]</description><category>SGU</category><pubDate>Sun, 08 Jun 2008 21:28:16 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/81#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/81</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/81</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253221/5058046</fs:itemid></item><item><title>SGU 172 — eXam</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253222/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/80/feed</wfw:commentRss><description>这道题WindyWinter牛给出的算法是并查集,实际上可以DFS解决(感谢alft&amp;#8230;).
每个人选的两个课程之间连无向边,然后DFS时进行黑白染色,DFS树上每个结点和他的父亲节点不同色.然后考虑横向边和返祖边,如果有一条边两边的结点颜色相同则说明无解,否则将白色的考试放在一天,黑色的放在另一天就可以了&amp;#8230;并查集当然也没错&amp;#8230;
注意会是一个森林,需要多次DFS&amp;#8230;
{ SGU 172; eXam - sqybi&amp;#8217;s code - DFS}//for my winstyprogram sgu172_sqybi;&amp;#160; const&amp;#160;&amp;#160;&amp;#160; nn = 200;&amp;#160;&amp;#160;&amp;#160; mm = 30000; 
&amp;#160; var&amp;#160;&amp;#160;&amp;#160; n, m, tot, i, x, y, t: longint;&amp;#160;&amp;#160;&amp;#160; flag: boolean;&amp;#160;&amp;#160;&amp;#160; head, p: array[1..nn]of longint;&amp;#160;&amp;#160;&amp;#160; adj, next: array[-mm..mm]of longint; 
&amp;#160; procedure addEdge(x, y: longint);&amp;#160;&amp;#160;&amp;#160; begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; inc(tot);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; adj[tot] := y;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; next[tot] := head[x];&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; head[x] := tot;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [...]</description><category>DFS</category><category>并查集</category><category>SGU</category><pubDate>Tue, 27 May 2008 21:09:39 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/80#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/80</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/80</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253222/5058046</fs:itemid></item><item><title>SGU 181 — X-Sequence</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253223/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/79/feed</wfw:commentRss><description>其实真的不难&amp;#8230;自己找一下规律吧.因为有mod m嘛&amp;#8230;然后就几个一循环而已&amp;#8230;
{ SGU 181; X-Sequence - sqybi&amp;#8217;s code}//for my winstyprogram sgu181_sqybi;&amp;#160; const&amp;#160;&amp;#160;&amp;#160; mm = 1000; 
&amp;#160; var&amp;#160;&amp;#160;&amp;#160; n, i: longint;&amp;#160;&amp;#160;&amp;#160; x, a, b, c, m, stop, r: int64;&amp;#160;&amp;#160;&amp;#160; f, t: array[0..mm]of longint; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(x, a, b, c, m, n);&amp;#160;&amp;#160;&amp;#160; if n = 0 then begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeln(x);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; halt;&amp;#160;&amp;#160;&amp;#160; end;&amp;#160;&amp;#160;&amp;#160; fillchar(f, sizeof(f), 0);&amp;#160;&amp;#160;&amp;#160; stop := 0;&amp;#160;&amp;#160;&amp;#160; [...]</description><category>SGU</category><pubDate>Sun, 25 May 2008 23:17:25 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/79#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/79</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/79</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253223/5058046</fs:itemid></item><item><title>SGU 169 — Numbers</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253224/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/78/feed</wfw:commentRss><description>bt的数学题.题解看这里:http://www.mydrs.org/dvp/dispbbs.php?boardid=13&amp;#38;id=436842楼说的还算比较详细&amp;#8230;我刚开始把题目里P的定义的乘法看成了加法所以一直不懂2楼说的,后来看题之后才发现自己看错了&amp;#8230;
{ SGU 169; Numbers - sqybi&amp;#8217;s code - Maths}//for my winstyprogram sgu169_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; n, t: longint; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(n);&amp;#160;&amp;#160;&amp;#160; if n = 1 then&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeln(8)&amp;#160;&amp;#160;&amp;#160; else begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; t := 1;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (n - 1) mod 3 = 0 then t := t + 2;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (n - 1) mod 6 = 0 then t := [...]</description><category>SGU</category><category>数学</category><pubDate>Sun, 25 May 2008 19:24:28 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/78#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/78</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/78</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253224/5058046</fs:itemid></item><item><title>SGU 175 — Encoding</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253225/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/77/feed</wfw:commentRss><description>稍微推导一下就可以得到一个递推式(这里直接借用WindyWinter的式子):pos[1,1]=1pos[n,q]=n-k+pos[k,k-q+1] (q&amp;#60;=k)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; =pos[n-k,n-q+1] (q&amp;#62;k)
求pos[n, q]即可.
{ SGU 175; Encoding - sqybi&amp;#8217;s code}//for my winstyprogram sgu175_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; n, t, q, k: longint; 
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(n, q);&amp;#160;&amp;#160;&amp;#160; t := 0;&amp;#160;&amp;#160;&amp;#160; while n &amp;#60;&amp;#62; 1 do begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; k := n div 2;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if q &amp;#60;= k then begin&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; t := t + n - k;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; n := k;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; q [...]</description><category>SGU</category><category>递推</category><pubDate>Sun, 25 May 2008 19:09:57 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/77#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/77</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/77</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253225/5058046</fs:itemid></item><item><title>SGU 144 — Meeting</title><link>http://item.feedsky.com/~feedsky/notablog/~6950155/87253226/5058046/1/item.html</link><wfw:commentRss>http://sqybi.72pines.com/posts/76/feed</wfw:commentRss><description>只说一句:图像法解决概率问题真好用.公式见程序.
{ SGU 144; Meeting - sqybi&amp;#8217;s code - Maths}//for my winstyprogram sgu144_sqybi;&amp;#160; var&amp;#160;&amp;#160;&amp;#160; x, y, z: double;
&amp;#160; begin&amp;#160;&amp;#160;&amp;#160; readln(x, y, z);&amp;#160;&amp;#160;&amp;#160; writeln((1-sqr((y-x)*60-z)/sqr((y-x)*60)):0:7);&amp;#160; end.
阅读(45 次)</description><category>SGU</category><category>数学</category><pubDate>Sun, 25 May 2008 18:53:48 +0800</pubDate><author>sqybi</author><comments>http://sqybi.72pines.com/posts/76#comments</comments><guid isPermaLink="false">http://sqybi.72pines.com/posts/76</guid><dc:creator>sqybi</dc:creator><fs:srclink>http://sqybi.72pines.com/posts/76</fs:srclink><fs:srcfeed>http://sqybi.72pines.com/feed</fs:srcfeed><fs:itemid>feedsky/notablog/~6950155/87253226/5058046</fs:itemid></item></channel></rss>