AgPro

导航

2010年6月23日 #

STL-set用法

摘要: // 1.set::begin/end #include #include using namespace std; int main () { int myints[] = {75,23,65,42,13,13}; set myset (myints,myints+6); set::iterator it; cout #include using namespace... 阅读全文

posted @ 2010-06-23 13:39 AgPro 阅读(13473) 评论(1) 推荐(1) 编辑

2010年6月22日 #

POJ1083

摘要: POJ1083-Moving Tables 太操蛋了,复杂的以为用BFS或者DFS,还算上拓扑排序,可是开始怎么挑点边的问题一直搞不定,看了下别人的解答,居然用cross[i]++,然后算最大值就可以搞定了! FUCK!! 阅读全文

posted @ 2010-06-22 17:27 AgPro 阅读(475) 评论(0) 推荐(0) 编辑

拓扑排序的模板

摘要: //拓扑排序的模板 #include using namespace std; struct data { int in; // 某点的入度 int out; // 某点的出度 }s[]; int a,b,n,stk[]; bool visited[]; bool map[][]; int calc() { int i,j; for(i=0;i> a >> b; ... 阅读全文

posted @ 2010-06-22 16:04 AgPro 阅读(828) 评论(0) 推荐(0) 编辑

2010年6月21日 #

A*算法解八数码(九宫格)问题

摘要: //POJ-1077 #include #include using namespace std; const int M = 362880; struct node { int state;//当前点表示方式 char action;//到达当前点的动作 int table;//0表示未访问,1表示在open表,2表示在close表,用于hash判重 int h;//h表示当前点到... 阅读全文

posted @ 2010-06-21 16:03 AgPro 阅读(1910) 评论(0) 推荐(0) 编辑

2010年6月13日 #

POJ题目分类

摘要: 1.排序 1423, 1694, 1723, 1727, 1763, 1788, 1828, 1838, 1840, 2201, 2376, 2377, 2380, 1318, 1877, 1928, 1971, 1974, 1990, 2001, 2002, 2092, 2379, 1002(需要字符处理,排序用快排即可) 1007(稳定的排序) 2159(题意较难懂) 2231 2371(简单... 阅读全文

posted @ 2010-06-13 17:31 AgPro 阅读(160) 评论(0) 推荐(0) 编辑

背包问题--贪心

摘要: #include using namespace std; int main() { int n = 3; int c = 8; int w[3] = {4,3,2}; int v[3] = {5,2,1}; float x[3]; int i; //1.Kanpsack //sort(w,v) for ( i=0; icap) break; x[i] = ... 阅读全文

posted @ 2010-06-13 15:09 AgPro 阅读(204) 评论(0) 推荐(0) 编辑

2010年6月12日 #

0-1背包问题-动态规划

摘要: #include using namespace std; //const int MAX_SIZE = 100; //int n; // 物品种类 //int c; // 背包重量限制 //int w[MAX_SIZE];//weight //int v[MAX_SIZE];//capacity //int x[MAX_SIZE];//falg //int m[MAX_SIZE][MAX... 阅读全文

posted @ 2010-06-12 15:01 AgPro 阅读(267) 评论(0) 推荐(0) 编辑

2010年6月11日 #

STL的vector、map、pair举例

摘要: #include #include #include #include using namespace std; int main() { vector the_vector; vector::iterator the_iterator; for( int i=0; i gMap; string strTemp = "help"; map::iterator it = gMa... 阅读全文

posted @ 2010-06-11 17:01 AgPro 阅读(2033) 评论(0) 推荐(0) 编辑

Predefined preprocessor variables

摘要: Predefined preprocessor variables Syntax: The following variables can vary by compiler, but generally work:The __LINE__ and __FILE__ variables represent the current line and current file being proces... 阅读全文

posted @ 2010-06-11 16:54 AgPro 阅读(198) 评论(0) 推荐(0) 编辑

C/C++ Reference

摘要: C/C++ Reference General C/C++ Pre-processor commands Operator Precedence Escape Sequences ASCII Chart Data Types Keywords Standard C Library Standard C I/O Standard C String & Character Standard... 阅读全文

posted @ 2010-06-11 15:45 AgPro 阅读(255) 评论(0) 推荐(0) 编辑