Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:代码好长,好晕,给你点我的理解

Posted by yxzzy at 2007-08-18 11:26:22 on Problem 1657
In Reply To:代码好长,好晕,给你点我的理解 Posted by:wrong123 at 2005-12-26 14:15:27
> /*Poj 1657   国际象棋的问题
> 王、后、车、象的走子规则 ---略掉
> 
> 问题:给定初始出发点,终点,让你算出: 王、后、车、象各自走到所需要
> 的步数,若不能达到则输出"Inf"
>   
> 分析:先把两个点的x,y方向的差算出来。若都为0,则无需移动,输出 0 0 0 0即可,否则: 
>  1.对于王:画一下它所需的最少步数为dx与dy的最大值
>  2.对于后:若"dx或者dy中某个为0,或者dx=dy"则它可以一步直达,否则需要两步
>  3.对于车:若"dx或者dy中某个为0",则一步即可,否则要两步
>  4.对于象:只有对角线斜线方向才可以走,dx-dy等于奇数的话,无论怎么移动它
>            它都到不了指定的终点 
>  
> */


这个思路好清晰,而且很完整,谢谢你

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator