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

NTHU OJ - 5711 Queue (Use C++ Standard Library)

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

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

NTHU OJ - 5710 Stack (Use C++ Standard Library)

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

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

2014年4月3日 星期四

NTHU OJ - 題目記錄 Problem records (2014年 二月-四月, February-April)

簡單記錄一下我過的NTHU OJ 題目和我認為的困難度,照月份分開
請點進來看我之前所AC的題目與程式!
  
This article simply record my Accepted NTHU OJ problems and the difficulty I thought.
Please click "Read more" to see my previous AC problems and programs.

由於NTHU OJ 可能有些題目是參考 UVa OJ或 PKU OJ  而來,那些題目我要是解過,我會放在 UVa OJ - 題目記錄 中或是 PKU OJ - 題目記錄。要是在這邊找不到可以去那邊看看,這邊只記錄 NTHU OJ 原創的題目和非 UVa 及 PKU OJ的題目。

Because some problems in NTHU OJ may be from UVa OJ, if I solved those problems, I would put them in the UVa OJ -  Problem records or PKU OJ - Problem records. If you don't find problems you want, maybe you can check that UVa OJ problem records. This page only records the original NTHU OJ problems or not from the UVa and PKU OJ.

2014年 四月 - 2014 April
AC problemsAC DateDifficultyClue / Hint
NTHU OJ - 5710 Stackv (Use C++ STL)4/06, 2014★☆☆☆☆Stack
NTHU OJ - 5711 Queue (Use C++ STL)4/06, 2014★☆☆☆☆Queue


2014年4月2日 星期三

UVa OJ - 441 Lotto

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

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


2014年3月30日 星期日

NTHU OJ - 7674 - PH - ASCII Tea Time

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

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

2014年3月29日 星期六

Python 學習小筆記 (五) - Conditionals & Control Flow (下)

Python 學習小筆記 (五) - Conditionals & Control Flow (下)

Python學習小筆記 for Codecademy Python
1.       Boolean運算子在判斷時,不是由左到右!如同數學也用先程除後加減。
在沒有特別括號的情形下,Boolean運算是如下:

Ø not  最先判斷
Ø and 第二判斷
Ø or   最後判斷

Ex:
False or not True and True à True

用括號來表示這樣: False or ((not True) and True)
雖有順序,但建議還是多多使用括號,避免閱讀困難。

2.       if…else… :就跟C很像,但條件式不用括號。
但是if要在條件式後面加上冒號,else後面也要冒號!
Ex:
if  9<19 :
        print "good"
else:
        print "bad"

3.      elif:就是C中的else if,可以在後面加上條件式。
Ex:
if  9<19 :
        print "good"
elif: 9>19
        print "bad"
else:
        print "ok"

Python 學習小筆記 (四) - Conditionals & Control Flow (上)

Python 學習小筆記 (四) - Conditionals & Control Flow (上)


1.       比較(關係)運算:都跟C, C++ 相同
Ø   ==   等於
Ø   !=    不等於
Ø   大於
Ø   >=   大於等於
Ø   <     小於
Ø   <=   小於等於

2.       當比較發生時,回傳的是boolean Type (True or False)
注意:True, False開頭是大寫。(C++是小寫的true, false)
Ex:
bool_test = 5 != 42
print bool_test à 輸出True

3.       邏輯運算 and, or:比較左右兩邊的boolean值,回傳boolean
Python跟C, C++ 很不同。C, C++ 裡面使用 &&, ||
Python直接使用英文and和or:and就是 &&, or 就是 ||
Ex:
bool_test1 = True or False  à True
bool_test2 = True and False à False
bool_test3 = 4 > 9 or False  à True
bool_test4 = 78 != 4 and 100 < 99à False

4.       邏輯運算 not:C, C++ 使用 "!" 代表not。
Python直接使用英文not
Ex:
not True à False
not not Falseà False
not 3**4 < 4**3 à True

Python 學習小筆記 (三) - Date and Time

Python 學習小筆記 (三) - Date and Time

Python 學習小筆記 for Codecademy Python



1.        要使用時間需要import datetime 才能用
用法: from datetime import datetime

2.        datetime.now() 表示現在時間
Ex: print datetime.now() à 2014-03-28 15:51:36.039938

也能用變數來存取這個"現在時間"
Ex: now = datetime.now()

3.        datetime.now() 也可以只取出年、月、日、時、分、秒等
Ex: print datetime.now().year   à 2014
Ex: print datetime.now().month  à 3
Ex: print datetime.now().day   à 28
Ex: print datetime.now().hour   à12
Ex: print datetime.now().minute à6
Ex: print datetime.now().second à32