2013年3月2日 星期六

ideone常見問題

Notepad++ Plugins - Browse /PyNPP at SourceForge.net


Notepad++ Plugins - Browse /PyNPP at SourceForge.net:

想在Notepad++執行Python Code,請用PyNPP取代NppExec會比較好用。
如果執意要用NppExec的話,請參考以下在NppExec中可run的script:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
SET python = C:\Python27_x86\python.exe
"$(python)" "$(FULL_CURRENT_PATH)"
UNSET python


如果想要即時print且在python 3.6上,可以使用以下:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
SET python = D:\Program Files\Python36\python.exe
"$(python)" -u "$(FULL_CURRENT_PATH)"
UNSET python


Note: unbuffered mode. This is done with the -u flag.

TCO 2012 Round 3B - TopCoder Wiki

TCO 2012 Round 3B - TopCoder Wiki:

對於CrossingTheRiver這題,
我嘗試去寫,卻一直Time Limit Exceed(超過2 seconds),
最後只好上網看解答…
我把我的TLE code貼在Ideone上:

看了AC code,原來我根本搞錯題意了,

這題的Blocks似乎不一定要擺完,
只要Blocks有辦法填滿Depth就可以直接過去了。 
CrossingTheRiver cr;
int my[] = {3, 3, 3, 3, 3, 4};
vector c(my, my + sizeof(my) / sizeof(int));
//AC code is possible, but my code is impossible.

2013年3月1日 星期五

用Notepad ++的plugin NppExec 執行 C++ Code

網路上有一篇文章

Notepad++ Compiler

提到可以用Notepad++當compiler,
不過對於C++的code要怎麼寫script來compiler卻沒說到,
我Google了一下,結合各家寫法,
 用以下script來run C++ code,效果還不錯,分享給大家:

NPP_SAVE
SET g++ = E:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
"$(g++)" -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
"$(g++)" "$(obj).o" -o "$(obj).exe"
NPP_RUN "$(obj).exe"
UNSET obj

UNSET g++


其中E:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe是
C++ compiler g++的位置,只要修改這個成自己的位置就可以使用了。
若是要用C++ 11,可用以下的寫法:

NPP_SAVE
SET g++ = C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\x86_64-w64-mingw32-g++.exe
SET obj = $(CURRENT_DIRECTORY)\$(NAME_PART)
"$(g++)" -std=c++11 -c "$(FULL_CURRENT_PATH)" -o "$(obj).o"
"$(g++)" "$(obj).o" -o "$(obj).exe"
NPP_RUN "$(obj).exe"
UNSET obj
UNSET g++

個人合成作品