2017年12月27日
摘要: 1、将压缩包wxWidgets-3.0.2.zip下载并解压到D盘根目录中,并将软件Codeblock的安装路径 D:\Program Files (x86)\CodeBlocks\MinGW\bin\加入环境变量Path中 2、cmd进入dos,并进入wxWidgets进行编译 ① d: ② cd 阅读全文
posted @ 2017-12-27 15:21 行者1992 阅读(350) 评论(0) 推荐(0) 编辑
  2013年6月5日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2531大意:防守队员只能平移,且一次移动一步,问碰到进攻球员的最少移动步数,每个队员的身体有多个格子构成,防守队员最多不超过20格,广搜! 1 //变形广搜 2 #include <stdio.h> 3 #include <iostream> 4 #include <queue> 5 #include <string.h> 6 using namespace std; 7 char map[105][105]; 8 bool vis[105][105]; 9 i 阅读全文
posted @ 2013-06-05 17:15 行者1992 阅读(176) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1372大意:骑士“日”字形移动,从初始点移动到终点所需要的最少步子数,广搜 1 /* 2 结构体加广搜可读性更好 3 用数组单独实现也可以,易出错,可读性也不好 4 数组实现的思路是:每个ans[]元素所走的步子数为 5 扩展出这个点的步子数加1 ans[h++]=ans[t-1]+1; 6 */ 7 8 #include <iostream> 9 #include <stdio.h>10 #include <string.h>11 #include <math.h& 阅读全文
posted @ 2013-06-05 17:05 行者1992 阅读(203) 评论(0) 推荐(0) 编辑
  2013年6月4日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2616 1 /* 2 全排列的变形,输入数据不重复 3 */ 4 #include <iostream> 5 #include <stdio.h> 6 #include <string.h> 7 #include <math.h> 8 using namespace std; 9 int a[15],mm[15];10 int used[15];11 int cal;12 int t;13 int ans=0xfffffff;14 void dfs(int n, 阅读全文
posted @ 2013-06-04 21:11 行者1992 阅读(150) 评论(0) 推荐(0) 编辑
摘要: N皇后问题http://acm.hdu.edu.cn/showproblem.php?pid=2553经典深搜:在棋盘上放置棋子,行、列、斜45度不重复 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <math.h> 5 6 using namespace std; 7 int count[15];//n的最大范围是10,打表! 8 int cal;//k个大小的棋盘放的数目 9 int map[15][15];//棋盘10 11 bool 阅读全文
posted @ 2013-06-04 21:04 行者1992 阅读(385) 评论(0) 推荐(0) 编辑
摘要: sticks http://acm.hdu.edu.cn/showproblem.php?pid=1455经典深搜 给你若干根短棒,将其组合成等长的木棒,尽可能短 ,并输出其长度 1 #include <iostream> 2 #include <stdio.h> 3 #include <math.h> 4 #include <algorithm> 5 #include <string.h> 6 using namespace std; 7 int sticks[70],used[70]; 8 int flag; 9 int n;10 阅读全文
posted @ 2013-06-04 20:55 行者1992 阅读(591) 评论(0) 推荐(0) 编辑
摘要: hdu 1016 Prime Ring Problemhttp://acm.hdu.edu.cn/showproblem.php?pid=1016大意:从1到n的n个数组成一个环,任意两个相邻的数之和为素数,环从1开始 1 /* 2 hdu 1016 Prime Ring Problem 3 2013-06-04 20:40:51 Accepted 1016 187MS 244K 1183 B C++ 4 有点字典树的感觉,父节点与子节点的和为素数 5 */ 6 7 #include <iostream> 8 #include <string.h> 9 #... 阅读全文
posted @ 2013-06-04 20:44 行者1992 阅读(976) 评论(0) 推荐(0) 编辑
  2013年5月30日
摘要: 二分法作为分治中最常见的方法,适用于单调函数,逼近求解某点的值。但当函数是凸性函数时,二分法就无法适用,这时三分法就可以“大显身手”如图,类似二分的定义Left和Right,mid=(Left+Right)/2,midmid=(mid+Right)/2;如果mid靠近极值点,则Right=midmid;否则(即midmid靠近极值点),则Left=mid; 程序模版如下: 1 double Calc(Type a) 2 { 3 /* 根据题目的意思计算 */ 4 } 5 void Solve(void) 6 { 7 double Left, Right; 8 doub... 阅读全文
posted @ 2013-05-30 16:09 行者1992 阅读(231) 评论(0) 推荐(0) 编辑
  2013年5月29日
摘要: 二分搜索其实就是折半查找或者说折半查找的灵活应用。折半的算法过程如下(为表达方便,过程并没有严格的按照语法写): 1 /* 2 在有序表中ST(假定为升序)中查找关键字为key的元素, 3 若查到返回元素在表中的位置,否则返回0 4 l,h分别为有序表的上下限 5 */ 6 int search(ST,key) 7 { 8 low=l,high=h;//置查找区间 9 while(low<high)10 {11 mid=(l+high)/2;12 if(ST[mid]==key)//找到返回13 return mi... 阅读全文
posted @ 2013-05-29 16:16 行者1992 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目大意:这道题就是给你一个圆台,里面装了一些水,现在告诉你圆台上下底半径,高度,水的体积,问你水的高度是多少。这道题可以二分搜索也可以计算几何,现在是计算几何的算法 1 /* 2 计算几何 3 本题可以用数学解法,也可以用2分搜索,但用数学方法解效率更高。 4 数学方法:cup的形状可能有两种,圆柱型,或是上大下小的圆台型。 5 如果是圆柱形则直接用体积除以底面积即得出高; 6 如果是圆台型,可以将圆台下边补全成为一个圆锥体,求出补全那部分的体积, 7 按照比例关系体积之比是高之比的3次方。 8 */ 9 #include <iostream>10 #include <st 阅读全文
posted @ 2013-05-29 15:43 行者1992 阅读(313) 评论(0) 推荐(0) 编辑