<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>「[轉載]學程式設計的人不能不看的好文章」的迴響</title>
	<atom:link href="http://www.vixual.net/blog/archives/99/feed" rel="self" type="application/rss+xml" />
	<link>http://www.vixual.net/blog/archives/99</link>
	<description>網路、空氣、水</description>
	<lastBuildDate>Fri, 27 Jan 2012 05:28:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>由：543</title>
		<link>http://www.vixual.net/blog/archives/99#comment-1305</link>
		<dc:creator>543</dc:creator>
		<pubDate>Wed, 18 Jan 2012 01:11:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-1305</guid>
		<description>1 =1
1-2 =-1
1-2+3 =2
1-2+3-4 =-2
1-2+3-4+5 =3
1-2+3-4+5-6 =-3
1-2+3-4+5-6+7 =4
1-2+3-4+5-6+7-8 =-4

n為奇數
1+(-2+3)+(-4+5)+(-6+7)……+ [ -(n-1)+n ]
n為偶數
(1-2)+(3-4)+(5-6)+(7-8)……+ [ (n-1)-n ]

so?
樓上都想太多</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/ie.png' alt='Internet Explorer' width='14' height='14' class='browsericon' /> Internet Explorer 9.0 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/win_7.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows 7<p>
1 =1<br />
1-2 =-1<br />
1-2+3 =2<br />
1-2+3-4 =-2<br />
1-2+3-4+5 =3<br />
1-2+3-4+5-6 =-3<br />
1-2+3-4+5-6+7 =4<br />
1-2+3-4+5-6+7-8 =-4</p>
<p>n為奇數<br />
1+(-2+3)+(-4+5)+(-6+7)……+ [ -(n-1)+n ]<br />
n為偶數<br />
(1-2)+(3-4)+(5-6)+(7-8)……+ [ (n-1)-n ]</p>
<p>so?<br />
樓上都想太多</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：貓居。C&#039;FrCo &#187; Blog Archive &#187; 日記｜一篇改變我一生的文字 - 一隻貓，一台thinkpad，走遍世界</title>
		<link>http://www.vixual.net/blog/archives/99#comment-1284</link>
		<dc:creator>貓居。C&#039;FrCo &#187; Blog Archive &#187; 日記｜一篇改變我一生的文字 - 一隻貓，一台thinkpad，走遍世界</dc:creator>
		<pubDate>Sun, 08 Jan 2012 11:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-1284</guid>
		<description>[...] 轉載http://www.vixual.net/blog/archives/99 [...]</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/wp.png' alt='WordPress' width='14' height='14' class='browsericon' /> WordPress 3.2.1<p>
[...] 轉載http://www.vixual.net/blog/archives/99 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：citypig</title>
		<link>http://www.vixual.net/blog/archives/99#comment-999</link>
		<dc:creator>citypig</dc:creator>
		<pubDate>Sun, 26 Jun 2011 00:52:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-999</guid>
		<description>To Fannie:

瀏覽器及作業系統資訊是用 &quot;Browser Sniff&quot; 這個外掛程式。

任何的專業技術都沒有可以一蹴可及的，共勉之。</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.18 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/win_vista.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows Vista<p>
To Fannie:</p>
<p>瀏覽器及作業系統資訊是用 "Browser Sniff" 這個外掛程式。</p>
<p>任何的專業技術都沒有可以一蹴可及的，共勉之。</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：Fannie</title>
		<link>http://www.vixual.net/blog/archives/99#comment-998</link>
		<dc:creator>Fannie</dc:creator>
		<pubDate>Sat, 25 Jun 2011 17:38:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-998</guid>
		<description>哈~~我不是寫程式的，但是我只是對你留言板有一個好奇。
我看到Win xp， linux Ubuntu，怎麼還是一堆人都在用XP。

很好奇這個留言板是你自己開發的嗎？
挺有趣的。

因為可以知道使用者的習慣，這支留言板的程式，我覺得還不錯。
至少這是我目前第一次看到的。

我最近在學AS3，突然很想學程式，可是看了這篇文章之後...才發要學程式之路，有很一大段的路程需要學習的。

我不敢想像，這要花多久的時間去學~~畢竟，已經不是學生了，沒有那麼多時間可以耗費在這上面，只能夠利用假日或是下班休息的時候學習。

我想，寫程式的方式，和想法應該都是一樣的吧！

想別人沒想過的，做別人沒做過的，才是成功的第一步。</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/google_chrome.png' alt='Google Chrome' width='14' height='14' class='browsericon' /> Google Chrome 12.0.742.100 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/win_7.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows 7<p>
哈~~我不是寫程式的，但是我只是對你留言板有一個好奇。<br />
我看到Win xp， linux Ubuntu，怎麼還是一堆人都在用XP。</p>
<p>很好奇這個留言板是你自己開發的嗎？<br />
挺有趣的。</p>
<p>因為可以知道使用者的習慣，這支留言板的程式，我覺得還不錯。<br />
至少這是我目前第一次看到的。</p>
<p>我最近在學AS3，突然很想學程式，可是看了這篇文章之後&#8230;才發要學程式之路，有很一大段的路程需要學習的。</p>
<p>我不敢想像，這要花多久的時間去學~~畢竟，已經不是學生了，沒有那麼多時間可以耗費在這上面，只能夠利用假日或是下班休息的時候學習。</p>
<p>我想，寫程式的方式，和想法應該都是一樣的吧！</p>
<p>想別人沒想過的，做別人沒做過的，才是成功的第一步。</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：ser</title>
		<link>http://www.vixual.net/blog/archives/99#comment-969</link>
		<dc:creator>ser</dc:creator>
		<pubDate>Mon, 04 Apr 2011 13:08:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-969</guid>
		<description>第二題還有更簡單得解法
const double xx = 1/2!+1/3!+1/4!+1/5!+1/6!;
const double yy = 1/5!+1/6!+1/7!+1/8!+1/9!;

fn(int n,int flag)
{
  if(flag==0)
    return xx*n; 
   
  if(flag==1)
    return yy*n;

  print (&quot;warring for fn()\n&quot;);
  return 0;
}</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/google_chrome.png' alt='Google Chrome' width='14' height='14' class='browsericon' /> Google Chrome 10.0.648.204 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
第二題還有更簡單得解法<br />
const double xx = 1/2!+1/3!+1/4!+1/5!+1/6!;<br />
const double yy = 1/5!+1/6!+1/7!+1/8!+1/9!;</p>
<p>fn(int n,int flag)<br />
{<br />
  if(flag==0)<br />
    return xx*n; </p>
<p>  if(flag==1)<br />
    return yy*n;</p>
<p>  print ("warring for fn()\n");<br />
  return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：JonesLai</title>
		<link>http://www.vixual.net/blog/archives/99#comment-723</link>
		<dc:creator>JonesLai</dc:creator>
		<pubDate>Fri, 17 Sep 2010 08:02:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-723</guid>
		<description>輸入-1會錯</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.8 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/ubuntu.png' alt='Ubuntu Linux' width='14' height='14' class='browsericon' />  Ubuntu Linux<p>
輸入-1會錯</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：JonesLai</title>
		<link>http://www.vixual.net/blog/archives/99#comment-722</link>
		<dc:creator>JonesLai</dc:creator>
		<pubDate>Fri, 17 Sep 2010 07:56:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-722</guid>
		<description>不過輸入負數，輸出會怪怪的...</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.8 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/ubuntu.png' alt='Ubuntu Linux' width='14' height='14' class='browsericon' />  Ubuntu Linux<p>
不過輸入負數，輸出會怪怪的&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：Simon Ho</title>
		<link>http://www.vixual.net/blog/archives/99#comment-710</link>
		<dc:creator>Simon Ho</dc:creator>
		<pubDate>Thu, 05 Aug 2010 12:54:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-710</guid>
		<description>很有趣...我也來賣弄一下

// using logic instructions.
inline long fn(long n)
{
    return  n&amp;1 ? ((n+1)&gt;&gt;1):-((n+1)&gt;&gt;1) ;
}

// using inline asm. 
long fn(long n)
{
    __asm{
        mov eax,n    ; Load n to AX
        inc eax      ; AX = AX + 1.
        shr eax,1    ; AX divides by 2.
        jnc EXIT     ; Exit if AX is a odd number.
        neg eax      ; AX = -AX ;
EXIT:
    }
}</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/ie.png' alt='Internet Explorer' width='14' height='14' class='browsericon' /> Internet Explorer 7.0 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
很有趣&#8230;我也來賣弄一下</p>
<p>// using logic instructions.<br />
inline long fn(long n)<br />
{<br />
    return  n&amp;1 ? ((n+1)&gt;&gt;1):-((n+1)&gt;&gt;1) ;<br />
}</p>
<p>// using inline asm.<br />
long fn(long n)<br />
{<br />
    __asm{<br />
        mov eax,n    ; Load n to AX<br />
        inc eax      ; AX = AX + 1.<br />
        shr eax,1    ; AX divides by 2.<br />
        jnc EXIT     ; Exit if AX is a odd number.<br />
        neg eax      ; AX = -AX ;<br />
EXIT:<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：JonesLai</title>
		<link>http://www.vixual.net/blog/archives/99#comment-707</link>
		<dc:creator>JonesLai</dc:creator>
		<pubDate>Wed, 04 Aug 2010 05:05:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-707</guid>
		<description>long fn(unsigned long n){
	return (long)n/2*(-1)+((n%2)?n:0);
}

型別有考慮進去，根本不需要考慮輸入負數產生的影響。</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.8 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
long fn(unsigned long n){<br />
	return (long)n/2*(-1)+((n%2)?n:0);<br />
}</p>
<p>型別有考慮進去，根本不需要考慮輸入負數產生的影響。</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：JonesLai</title>
		<link>http://www.vixual.net/blog/archives/99#comment-706</link>
		<dc:creator>JonesLai</dc:creator>
		<pubDate>Wed, 04 Aug 2010 04:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-706</guid>
		<description>egg說法有錯，型別為long，本來就會無條件捨去。
效果等同底下吧～
if(0==n%2)	return (n/2)*(-1);
else		return ((n+1)/2);

事實上還可以再簡約一點：
(n/2)*(-1)+(n%2)?n:0;
這樣就好了～哈
這都是事後諸葛亮了吧～
面試一緊張有些就什麼都忘了的說～</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.8 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
egg說法有錯，型別為long，本來就會無條件捨去。<br />
效果等同底下吧～<br />
if(0==n%2)	return (n/2)*(-1);<br />
else		return ((n+1)/2);</p>
<p>事實上還可以再簡約一點：<br />
(n/2)*(-1)+(n%2)?n:0;<br />
這樣就好了～哈<br />
這都是事後諸葛亮了吧～<br />
面試一緊張有些就什麼都忘了的說～</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：程式鄉巴佬</title>
		<link>http://www.vixual.net/blog/archives/99#comment-703</link>
		<dc:creator>程式鄉巴佬</dc:creator>
		<pubDate>Wed, 14 Jul 2010 09:27:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-703</guid>
		<description>我是個初學者，我也有了錯誤的觀念了…我也以為程式碼的簡短就是好…看了版主的這些文章後，才知道並非如此…</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/firefox.png' alt='Mozilla Firefox' width='14' height='14' class='browsericon' /> Mozilla Firefox 3.6.6 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
我是個初學者，我也有了錯誤的觀念了…我也以為程式碼的簡短就是好…看了版主的這些文章後，才知道並非如此…</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：egg</title>
		<link>http://www.vixual.net/blog/archives/99#comment-134</link>
		<dc:creator>egg</dc:creator>
		<pubDate>Sat, 20 Sep 2008 17:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-134</guid>
		<description>long fn(long n) {
  if(n 0);
    exit(1);
  }
  if(0==n%2)
    return (n/2)*(-1);
  else
    return (n/2)*(-1)+n;
}


在爬文時看到這篇
有個小小的錯誤

  if(0==n%2)
    return (n/2)*(-1);
  else
    return (n/2-0.5)*(-1)+n;

當N為單數時,要捨去</description>
		<content:encoded><![CDATA[Using <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/ie.png' alt='Internet Explorer' width='14' height='14' class='browsericon' /> Internet Explorer 6.0 on  <img src='http://www.vixual.net/blog/wp-content/plugins/browser-sniff/icons/windows.png' alt='Windows' width='14' height='14' class='browsericon' />  Windows XP<p>
long fn(long n) {<br />
  if(n 0);<br />
    exit(1);<br />
  }<br />
  if(0==n%2)<br />
    return (n/2)*(-1);<br />
  else<br />
    return (n/2)*(-1)+n;<br />
}</p>
<p>在爬文時看到這篇<br />
有個小小的錯誤</p>
<p>  if(0==n%2)<br />
    return (n/2)*(-1);<br />
  else<br />
    return (n/2-0.5)*(-1)+n;</p>
<p>當N為單數時,要捨去</p>
]]></content:encoded>
	</item>
	<item>
		<title>由：Anonymous</title>
		<link>http://www.vixual.net/blog/archives/99#comment-4</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Tue, 30 Oct 2007 03:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.vixual.net/blog/?p=99#comment-4</guid>
		<description>程式設計師本來就必須要想到程式的執行效率，尤其是設計有關數學演算法的問題。
在BigO(1) 做得完的事情, 就沒有必要花費BigO(n) 去做。1-2+3-4+5-6+7......+n看就知道兩組當一項都是-1, 當然是一道簡化的數學式即可算出，根本就不需要使用迴圈去計算。
更例如算費氏數列，絕大多數人都使用遞迴計算，但是n帶很大的時候，效率卻差到不行;但是事實上不論n多少, 是有BigO(1)就計算出來的作法。有規則的東西都幾乎可以用BigO(1)的演算法來計算得到結果，就端看設計者的功力和數學好不好而定。</description>
		<content:encoded><![CDATA[<p>
程式設計師本來就必須要想到程式的執行效率，尤其是設計有關數學演算法的問題。<br />
在BigO(1) 做得完的事情, 就沒有必要花費BigO(n) 去做。1-2+3-4+5-6+7&#8230;&#8230;+n看就知道兩組當一項都是-1, 當然是一道簡化的數學式即可算出，根本就不需要使用迴圈去計算。<br />
更例如算費氏數列，絕大多數人都使用遞迴計算，但是n帶很大的時候，效率卻差到不行;但是事實上不論n多少, 是有BigO(1)就計算出來的作法。有規則的東西都幾乎可以用BigO(1)的演算法來計算得到結果，就端看設計者的功力和數學好不好而定。</p>
]]></content:encoded>
	</item>
</channel>
</rss>

