杭电ACM OJ 1030 Delta-wave 3维降2维坐标系法+图的搜索法

博客详细介绍了杭电ACM在线判题(OJ)中1030题——Delta-wave的解决方案。通过3维坐标系降至2维坐标系的方法,结合图的搜索算法,阐述了如何有效地解决这一问题。
摘要由CSDN通过智能技术生成

Delta-wave

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9688    Accepted Submission(s): 3882


Problem Description
A triangle field is numbered with successive integers in the way shown on the picture below. 


                                                                       

The traveller needs to go from the cell with number M to the cell with number N. The traveller is able to enter the cell through cell edges only, he can not travel from cell to cell through vertices. The number of edges the traveller passes makes the length of the traveller's route. 

Write the program to determine the length of the shortest route connecting cells with numbers N and M. 
 

Input
Input contains two integer numbers M and N in the range from 1 to 1000000000 separated with space(s).
 

Output
Output should contain the length of the shortest route.
 

Sample Input
  
  
  
6 12
 

Sample Output
  
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值