yuanheng's profileοo怅惘ヤo ACM-ICPC HomePagePhotosBlogListsMore ![]() | Help |
οo怅惘ヤo ACM-ICPC HomePage- - 宅男的我 继续被水题虐去 -v- | 默默地做事,朝着自己的目标一步步前进! |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
吃了顿羊肉-v-饱饱 今晚吃了顿羊肉,味道特爽^_^ 还有9个多小时就final了 January 31 不再公开我的解题报告了 由于某些原因,不再在blog上公开我的OJ解题报告了 T_T ACM-ICPC全球总决赛现场直播 http://live6.hrbeu.edu.cn 由于没有钱,承担不起自费去观摩Final唯有通过现场直播了... 迟点有可能过去澳门玩儿。。。 睡觉去,明个儿早起继续奋斗! January 25 - - 感冒了 T_T 今天早上一觉醒来按照以往的惯例到冲凉房刷牙、冲一个热水澡 因为洗完澡之后的舒适度比较好,有利于接下来的训练 没有想到的是,洗完澡回到自己的房间之后突然觉得有点晕晕的感觉 对着电脑屏幕总觉得眼前出现很多星星,而且有种想呕吐的预兆 就跑到洗手间,果然呕了出来。。。 接下来头特别疼、接二连三的跑到洗手间去呕吐(呕到连胃液都呕了出来=_=!) 这下子肯定是冲热水澡不小心着凉了T_T 马上去了趟伯父家吊了一瓶点滴、回来后也吃了药 现在感冒应该没了~~~ January 24 POJ 1915 解题报告Knight Moves
Description Background Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him? The Problem Your task is to write a program to calculate the minimum number of moves needed for a knight to reach one point from another, so that you have the chance to be faster than Somurolov. For people not familiar with chess, the possible knight moves are shown in Figure 1.
Input The input begins with the number n of scenarios on a single line by itself.
Next follow n scenarios. Each scenario consists of three lines containing integer numbers. The first line specifies the length l of a side of the chess board (4 <= l <= 300). The entire board has size l * l. The second and third line contain pair of integers {0, ..., l-1}*{0, ..., l-1} specifying the starting and ending position of the knight on the board. The integers are separated by a single blank. You can assume that the positions are valid positions on the chess board of that scenario. Output For
each scenario of the input you have to calculate the minimal amount of
knight moves which are necessary to move from the starting point to the
ending point. If starting point and ending point are equal,distance is
zero. The distance must be written on a single line. Sample Input 3 Sample Output 5 Source TUD Programming Contest 2001, Darmstadt, Germany
【算法介绍】:BFS(Breadth – First Search)。 【题目描述】:第一行一个整数n,代表有n组测试数据。每组测试数据有3行,第一行为棋 盘的规模k,也就是(0...k-1)*(0...k-1)的棋盘,第二行是骑士的起始 位置(x1,y1),第3行市骑士的终点位置(x2,y2)。问:对于每组测试数据, 求出从起始位置到终点位置所跳的最少步数。 【题目分析】:广度优先搜索去搞就可以了。 #include <cstdio> |
The Websites Of Programming Contest
The Blogs Of My Good Friends
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|