自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 poj3984迷宫问题

http://poj.org/problem?id=3984宽搜,但是最后要求输出路径。所以队列里的元素应记录了指向父结点。我在node结构体里设置了father成员,然而它并不是直接指向父结点的指针,而是存储父结点在队列中的位置。这样的话,最后输出路径的时候,通过father(父结点队列位置)就可以访问父结点了。#include #include typedef stru

2016-06-18 13:28:28 284

原创 poj1724ROADS

http://poj.org/problem?id=1724解题思路:从城市 1开始深度优先遍历整个图,找到所有能到达 N 的走法 , 选一个最优的。优化:1) 如果当前已经找到的最优路径长度为L ,那么在继续搜索的过程中,总长度已经大于L的走法,就可以直接放弃,不用走到底了2) 用midL[k][m] 表示:走到城市k时总过路费为m的条件下,最优路径的长度。若在后续的

2016-06-17 13:26:29 325

原创 poj3083Children of the Candy Corn

http://poj.org/problem?id=3083#include #include #define Max 50int w,h;char maze[Max][Max];int start_x,start_y,end_x,end_y;int dir[4][2]={{0,-1},{-1,0},{0,1},{1,0}};//左上右下int visited[Max][Max]

2016-06-15 22:37:18 305

原创 poj2049Finding Nemo

http://poj.org/problem?id=2049#include #include #define MAX_N 210 #define INT_MAX 32767int v[MAX_N + 1][MAX_N + 1]; //v[i][j]为到达格子[i][j]的最小步骤数int Round[MAX_N + 1][MAX_N][4]; //用左上角点的坐标来指代格子,第三维

2016-06-14 19:54:23 459

原创 poj3278Catch That Cow

http://poj.org/problem?id=3278操,没剪枝,RE无数次。。#include #include #define Max 100001int visited[Max],queue[Max],n,k;int Breadth_FirstSearch(int p){ int front=0,rear=0,head,i,temp; if(p==k)

2016-06-12 18:22:22 287

原创 poj3267The Cow Lexicon

http://poj.org/problem?id=3267第一个接触动态规划:状态方程:这篇博客比较好:http://user.qzone.qq.com/289065406/blog/1299653270#include#includechar dict[600][25],mesg[300];int dp[301],wordlen[600];int min(i

2016-06-12 00:25:27 322

原创 poj1094Sorting It All Out

http://poj.org/problem?id=1094#include#includeint map[27][27],indegree[27],q[27];//q[]存储序列值int TopoSort(int n) //拓扑排序 { int c=0,temp[27],loc,m,flag=1,i,j;//flag=1:有序 flag=-1:不确定 for(i=1;

2016-06-08 22:39:10 229

原创 hdu1285确定比赛名次

http://acm.hdu.edu.cn/showproblem.php?pid=1285拓扑排序,邻接矩阵存储,注意重边#include #include int adjMatrix[501][501],indegree[501];int n,m;void initTopo(){ int p1,p2; memset(indegree,0,sizeof(inde

2016-06-06 13:23:06 257

原创 poj2993Emag eht htiw Em Pleh

http://poj.org/problem?id=2993模拟#include#include#define Max 100char map[17][34] = { "+---+---+---+---+---+---+---+---+",//初始化棋盘 "|...|:::|...|:::|...|:::|...|:::|",

2016-06-05 12:04:48 361

原创 poj2996Help Me with the Game

http://poj.org/problem?id=2996模拟#include typedef struct node{ int x; char y; char ch;}Piece;Piece wPiece[16],bPiece[16];int n1,n2;char square[17][33];void findbp(char p){ i

2016-06-05 12:02:41 267

原创 hdu5414 CRB and String

http://acm.hdu.edu.cn/showproblem.php?pid=54141.s中的字母都要保留下来2.s,t的第一个字母必相同,并且同时t中第一个字符连续的个数必等于s中第一个字符连续的个数,不能大于它。比如 s: aaxyz  t: aaxybz符合要求。s: aaxyz t: aaaxybz就不符合要求。附:只需考虑第一个连续字符,比如:s: aax

2016-06-04 22:39:03 310

原创 poj1573Robot Motion

http://poj.org/problem?id=1573简单模拟。#include #include int main(){ int m,n,t,bit[11][11],i,j,k,ans; char data[11][11]; while((~scanf("%d %d %d",&m,&n,&t))&&m&&n&&t) {

2016-06-03 10:14:55 266

原创 poj2632Crashing Robots

http://poj.org/problem?id=2632模拟算法:将整个过程完完整整的走一遍。题目怎么叙述的,程序就怎么运行。所以模拟题对算法设计的要求不高,但是需要大家选择最适当的数据结构来进行模拟,模拟题一般都很繁琐,所以信心和精心是必不可少的。本题注意点挺多的,变量也很多,稍不注意就会错~~也算是一道比较让人头疼的模拟题了。#include #include int ar

2016-06-02 12:24:27 500

原创 poj1013 Counterfeit Dollar

http://poj.org/problem?id=101312个硬币里有1个假币,枚举每一个硬币,如果它是轻或是重,则为假币。那么如何判断它是轻或是重呢?判断是轻:    假设它就是轻。然后由天平三次称量结果倒推:如果称量结果为up,则它一定在右边。如果称量结果为even,则它既不在左边,也不在右边。如果称量结果为down,则它一定在左边。上述都满足,则毫无疑问它就是轻。否则

2016-06-02 09:25:32 454

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除