2014/09/06

POJ 1915 Knight Moves

Description
Background
Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?
The Problem
Your task is to write a program to calculate the minimum number of moves needed for a knight to reach one point from another, so that you have the chance to be faster than Somurolov.
For people not familiar with chess, the possible knight moves are shown in Figure 1.

2014/09/01

用 Notepad++ 寫 C/C++

1. Plugins -> NppExec -> Follow $(CURRENT_DIRECTORY)
    (如果沒有看到NppExec,就到Plugin Manager找到它然後安裝)

2.把Compiler的位置加入系統環境變數
   如果電腦上已經有安裝其他IDE(ex: Dev C++、CodeBlocks),可以直接拿他們的Compiler來用
    以安裝Dev C++的電腦為例,在環境變數path中加入
    C:\Program Files (x86)\Dev-Cpp\MinGW32\bin

3.Plugins -> NppExec -> Execute 
   (或者直接用快捷鍵 F6)
   接著在欄位內填入
 
   你的Compiler位置  "$(FULL_CURRENT_PATH)" -o $(NAME_PART)
 
    以接續第二步驟的例子來說,就是

    C:\Program Files (x86)\Dev-Cpp\MinGW32\bin\g++.exe "$(FULL_CURRENT_PATH)" -o $(NAME_PART)

4.設定完成就可以在Notepad++裡面coding了,寫完之後存成c/cpp檔,按下F6即可編譯

5.要執行的話就在Notepad++下方console畫面輸入執行檔名,就可以看到執行結果


[自動完成]

使用其他IDE有個好用的功能,就是自動完成符號配對和提示參數名稱
在Notepad++要開啟這個功能,從 自訂 ->使用者自訂 -> 字詞自動完成功能 裡面去做設定