01 2011 档案

摘要:网上转载,有点偷懒 阅读全文
posted @ 2011-01-23 20:55 Cranny 阅读(415) 评论(0) 推荐(0)
摘要:#include #include using namespace std; /* 贪婪法: 1)当人数4时,a,b,..,c,d(升序) 过去,回来,过去,回来(船要回来),让最大的2个过去. 很笨的时间是d+c+c+a=d+2c+a(所有时间都写出来后会发现时最慢的) 如果让最小的来送:d+a+c+a=d+c+2a 否则:b+b+a+d=d+2b+a 如果d+c+2a>t; whil... 阅读全文
posted @ 2011-01-23 16:46 Cranny 阅读(649) 评论(0) 推荐(0)
摘要:做了好几天,几个小错误,没耐心都没调试出来..A* 最小堆 hash表 还是超时..诶告一段落... 阅读全文
posted @ 2011-01-21 22:56 Cranny 阅读(292) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std; /* *八数码,未优化版 *总结 *如果用vector来保存的话,路径回溯有问题 *用map实现链表的随机访问或者直接在map上做 *用hash计算后在数组上做. *都可以以logn的时间减小.这个只是自己玩玩.所以没弄那么多. *以前看书的时候,说给链表加个头结点会很方便操作,一直没放在心上,... 阅读全文
posted @ 2011-01-18 21:24 Cranny 阅读(347) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1077 Source Code Problem: 1077 User: p_hoenix Memory: 220K Time: 0MS Language: C++ Result: Accepted Source Code #include #include #include #include #include u... 阅读全文
posted @ 2011-01-16 21:29 Cranny 阅读(572) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1077 /* procedure dfs(depth:longint); begin if 要剪枝 then exit; if 可行 then Print; if Depth #include using namespace std; struct Status { int board[3][3]; int... 阅读全文
posted @ 2011-01-16 02:13 Cranny 阅读(2242) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=1664 //整数划分问题 #include using namespace std; /* f(n,m)表示将正整数n划分成若干个不大于m的整数的和的分法 f(n,m) = 1 n = 1 || m = 1 f(n,n) n m > 1 */ int f(int n, int m) { if(n ==... 阅读全文
posted @ 2011-01-15 13:54 Cranny 阅读(274) 评论(0) 推荐(0)
摘要://http://poj.org/problem?id=2449 #include #include #include #include using namespace std; typedef pair pii;//距离,顶点 struct Arc { int vex; int weight; }; const int MAX_VEX_NUM = 1010; const ... 阅读全文
posted @ 2011-01-14 17:57 Cranny 阅读(302) 评论(0) 推荐(0)
摘要:#include #include using namespace std; class Screen; class ScreenPtr; class Screen { public: typedef string::size_type index; Screen(int r = 4, int c = 3) { contents.resize(r * c, '#'); he... 阅读全文
posted @ 2011-01-13 20:24 Cranny 阅读(267) 评论(0) 推荐(0)
摘要://MFC.h #define BOOL int #define TRUE 1 #define FALSE 0 #include using namespace std; class CObject { public: CObject(){}; ~CObject(){}; }; class CCmdTarget : public CObject { public: CCmdTa... 阅读全文
posted @ 2011-01-03 20:14 Cranny 阅读(626) 评论(0) 推荐(0)
摘要://MFC.h #include using namespace std; class CObject { public: CObject() { cout #include "MFC.h" using namespace std; class CMyWinApp : public CWinApp { public: CMyWinApp() { cout<<"CMyWinA... 阅读全文
posted @ 2011-01-03 20:10 Cranny 阅读(293) 评论(0) 推荐(0)
摘要:#include using namespace std; class ClassA { public: int m_data1; int m_data2; void func1(){} void func2(){} virtual void vfunc1(){} virtual void vfunc2(){} }; class ClassB : public Clas... 阅读全文
posted @ 2011-01-03 20:06 Cranny 阅读(174) 评论(0) 推荐(0)