qeatzy

2015年7月9日

leetcode N-Queens/N-Queens II, backtracking, hdu 2553 count N-Queens, dfs 分类: leetcode hdoj 2015-07-09 02:07 102人阅读 评论(0) 收藏

摘要: for the backtracking part, thanks to the video of stanford cs106b lecture 10 by Julie Zelenski for the nice explanation of recursion and backt... 阅读全文

posted @ 2015-07-09 02:07 qeatzy 阅读(132) 评论(0) 推荐(0) 编辑

2015年6月19日

hdu 1057 (simulation, use sentinel to avoid boudary testing, use swap trick to avoid extra copy.) 分类: hdoj 2015-06-19 11:58 25人阅读 评论(0) 收藏

摘要: use sentinel to avoid boudary testing, use swap trick to avoid extra copy. original version#include #include int main() { //freopen("input... 阅读全文

posted @ 2015-06-19 11:58 qeatzy 阅读(156) 评论(0) 推荐(0) 编辑

2015年6月18日

hdu 1053 (huffman coding, greedy algorithm, std::partition, std::priority_queue ) 分类: hdoj 2015-06-18 19:11 22人阅读 评论(0) 收藏

摘要: huffman coding, greedy algorithm. std::priority_queue, std::partition, when i use the three commented lines, excution time increase to 15ms f... 阅读全文

posted @ 2015-06-18 19:11 qeatzy 阅读(100) 评论(0) 推荐(0) 编辑

hdu 1052 (greedy algorithm) 分类: hdoj 2015-06-18 16:49 35人阅读 评论(0) 收藏

摘要: thanks to http://acm.hdu.edu.cn/discuss/problem/post/reply.php?action=support&postid=19638&messageid=1&deep=0 for the test case provided. belo... 阅读全文

posted @ 2015-06-18 16:49 qeatzy 阅读(83) 评论(0) 推荐(0) 编辑

hdu 1051 (greedy algorithm, how a little modification turn 15ms to 0ms) 分类: hdoj 2015-06-18 12:54 29人阅读 评论(0) 收藏

摘要: the 2 version are essentially the same, except version 2 search from the larger end, which reduce the search time in extreme condition from l... 阅读全文

posted @ 2015-06-18 12:54 qeatzy 阅读(119) 评论(0) 推荐(0) 编辑

hdu 1050 (preinitilization or postcleansing, std::fill) 分类: hdoj 2015-06-18 11:33 34人阅读 评论(0) 收藏

摘要: errors, clauses in place, logical ones, should be avoided.#include #include #include int main() { //freopen("input.txt","r",stdin); cons... 阅读全文

posted @ 2015-06-18 11:33 qeatzy 阅读(147) 评论(0) 推荐(0) 编辑

hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos) 分类: hdoj 2015-06-18 08:21 39人阅读 评论(0) 收藏

摘要: errors made, boundary conditions, #include char* sum(char *to, char *from) { static const int charzero='0',oublecharzero='0'+'0'; int s... 阅读全文

posted @ 2015-06-18 08:21 qeatzy 阅读(138) 评论(0) 推荐(0) 编辑

2015年6月17日

hdu 1041 (OO approach, private constructor to prevent instantiation, sprintf) 分类: hdoj 2015-06-17 15:57 25人阅读 评论(0) 收藏

摘要: a problem where OO seems more natural to me, implementing a utility class not instantiable. how to prevent instantiation, thanks to http://st... 阅读全文

posted @ 2015-06-17 15:57 qeatzy 阅读(133) 评论(0) 推荐(0) 编辑

2015年6月16日

hdu 1039 (string process, fgets, scanf, neat utilization of switch clause) 分类: hdoj 2015-06-16 22:15 38人阅读 评论(0) 收藏

摘要: (string process, fgets, scanf, neat utilization of switch clause) simple problem, simple code.#include #include #define MAXLEN 22char password... 阅读全文

posted @ 2015-06-16 22:15 qeatzy 阅读(118) 评论(0) 推荐(0) 编辑

hdu 1036 (I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol) 分类: hdoj 2015-06-16 19:37 32人阅读 评论(0) 收藏

摘要: thanks to http://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input and http://stackoverflow.com/questions/456303/how-to-v... 阅读全文

posted @ 2015-06-16 19:37 qeatzy 阅读(258) 评论(0) 推荐(0) 编辑

导航