有些內容使用中英雙語,有些只有英文或中文。歡迎使用與分享任何內容,但先來信告知並標示此部落格為出處。
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年4月17日 星期四

Codeforces - 416A Guess a number!

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

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

2014年4月14日 星期一

[中譯題目] Codeforces - 1A Theatre Square

1 A. Theatre Square

時間限制: 每個 test case 2 秒
記憶體限制: 每個 test case 64 M

在 Berland 的 Theatre Square 有個 n × m 平方公尺的矩形廣場。 在城市週年慶時,大家決定在廣場上鋪上花崗岩石板。每個石版的大小是 a × a 平方公尺。

請問最少需要多少塊石板才能鋪滿整個廣場? 覆蓋面積可以比廣場要大,但是廣場必須被鋪滿。不能打破石版,並且石版的邊必須平行廣場的邊。

[中譯題目] Codeforces - 401A Vanya and Cards

401 A. Vanya and Cards

時間限制: 每個 test case 1 秒
記憶體限制: 每個 test case 256 M

Vanya 喜歡玩樂! 他甚至用一套特別卡組來玩遊戲。 每張卡有一個特定數字。 此數字可以為正數、負數、或是等於零。只有一個限制,在卡片上數字的絕對值不會超過 x。 The only limit is, the number on each card doesn't exceed x in the absolute value.

Natasha 不喜歡 Vanya 花這麼多時間在玩樂上,所以她把所有卡片都藏了起來。Vanya 非常傷心得找他的卡片,但他只找的到其中的 n 張卡片。Vanya 喜歡平衡,所以他希望找到的卡片上的數字總和能等於零。另一方面,他也對找卡片感到非常疲倦,所以幫幫這個小男孩。
告訴他最少卡需要多少張卡片才能讓總合等於零?

你可以假設一開始 Vanya 每個數字 (從 x 到 -x) 都有無限張的卡片。

2014年4月13日 星期日

[Javascript] 舞動你的名字! Animate Your Name!

Rock your name! 快點進來看! Come inside!

Google Code Jam - Qualification Round 2014 - Problem B. Cookie Clicker Alpha (for small and large)

The following program is my ACcepted code for
GCJ-Qualification 2014 - B. Cookie Clicker Alpha .

This program is correct for the small and large input.
It's a for everybody to learn and discuss.
If there is any mistake or comment, please let me know.  :D

此乃 GCJ-Qualification 2014 - B. Cookie Clicker Alpha 的AC code!
這份程式在小跟大的測試資料都是正確的!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

前往 Google Code Jam!

Google Code Jam - Qualification Round 2014 - Problem A. Magic Trick

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

此乃GCJ-Qualification 2014-A. Magic Trick 的AC code!
歡迎一同討論學習,如有錯誤與任何建議請留言 : )

前往 Google Code Jam!