有些內容使用中英雙語,有些只有英文或中文。歡迎使用與分享任何內容,但先來信告知並標示此部落格為出處。
Some parts use both Chinese and English, but some parts use only one language. Feel free to share, but please contact me first and list this blog as your reference.

2014年3月6日 星期四

UVa OJ - 674 Coin Change

The following program is my ACcepted code for UVA-674 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃UVA 674  的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )


我之後應該會寫一小篇來解釋這種題目的 DP 思路
但可能要等一小段時間了,如果很想知道的話可以留言,我會趕快寫
I think I will write a small article to explain this problem's DP thought,
but that will in the future some time(?).
If you want to know about that, please leave a commend and I will work on it soon.

此題目可以使用int,因為他的n值比較小。
This problem can be solved when you use int because its n may be smaller.

2014年3月5日 星期三

UVa OJ - 10071 Back to High School Physics

The following program is my ACcepted code for UVA-10038 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃UVA 10038 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )


一個簡單的高中物理題
讓我們回想一下這個方程式: V = V0 + a * t
我把 2 倍時間的速度稱為 "V2"
此V2 =  V0 + 2 * a * t
而經過 2 倍時間的位移 = (V2 + V0) * 2 * t / 2
= (2 * V0 + 2 * a * t ) * t = 2 * (V0 + a * t) * t = 2 * V * t !

It's a simple High School Physics.
Let's remind this equation: V = V0 + a * t .
I call the V in twice of that time "V2".
This V2 = V0 + 2 * a * t .
and the displacement be in twice of that time = (V2 + V0) * 2 * t / 2
= (2 * V0 + 2 * a * t ) * t = 2 * (V0 + a * t) * t = 2 * V * t !

Fun Stuff 歡樂東東 - Short Comics 翻譯短篇漫畫 (一)


下面附上英文原圖方便參考 :P
Below is the English Original Picture for your reference.


2014年3月4日 星期二

UVa OJ - 10038 Jolly Jumpers

The following program is my ACcepted code for UVA-10038 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃UVA 10038 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )


UVa OJ - 10062 Tell me the frequencies!

The following program is my ACcepted code for UVA-10062 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃UVA 10062 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

這題被 "A blank line should separate each set of output. " 偷襲到了。
是每個test case 中間要格一行空白,最後一個case後面不能空白
所以我在除了第一個case後面的每個case都先輸出一行空白。

Because the problem said "A blank line should separate each set of output.",
between cases, there should be a blank line. (the last case is not needed)

NTHU OJ - 7645 PA - Cake V.S. Rational number

The following program is my ACcepted code for NTHU-7648 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃NTHU 7648 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

點這裡看題目 Click here to see this Problem!

題目說 "特別注意:行末不得有空白。"
所以我以為是測資間需要一行空白,但是最後不能空白
但這樣會拿到很多WA
最後我在每個測資後面都輸出一行空白,就AC了...

UVa OJ - 357 Let Me Count The Ways

The following program is my ACcepted code for UVA-357 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃UVA 357 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )


我之後應該會寫一小篇來解釋這種題目的 DP 思路
但可能要等一小段時間了,如果很想知道的話可以留言,我會趕快寫
I think I will write a small article to explain this problem's DP thought,
but that will in the future some time(?).
If you want to know about that, please leave a commend and I will work on it soon.

因為 n 的index範圍會大到30000
那會讓答案超過int範圍,
所以我使用int int long
如果是UVA 674 Coin Change,就可以使用int
因為他的n值比較小

Because the index range from 1 to 30000,
it will over the int range!
so I used long long int
The UVa 674 Coin Change can be solved when you use int
because its n may be smaller.

2014年3月3日 星期一

NTHU OJ - 7648 PD - Mine Threat

The following program is my ACcepted code for NTHU-7648 .
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃NTHU 7648 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

點這裡看題目 Click here to see this Problem!

跟 NTHU 7653 PD - Pick Up Thumbtacks 簡直是一模一樣
有興趣可以點上面連結
本題是找遠到近 ~