Redian新闻
>
这个算法游戏怎么才能用最高效的方法解决啊?
avatar
这个算法游戏怎么才能用最高效的方法解决啊?# Computation - 科学计算
n*t
1
You are at square [0, 0] of an n*n grid. There is $1,000,000 on square [n - 1
, n - 1]. Your goal is to reach that square and take the money. You can
traverse the grid only by going to the square to the right, left, up or down.
Unfortunately some squares have killer monsters. Entering any of these squares
means a slow and painful death. There are no killer monsters on [0, 0] and [n
- 1, n - 1]. Other squares have greedy dragons. To enter any of these squares
you must pay a $1000. You have borro
avatar
s*t
2
Just use standard shortest path algorithm.
any edge incident to point that has killer monster has cost = +inf
points has dragon has cost = 1000.
Look for a shortest path from (0,0) to (n-1,n-1).

1
.
squares
[n
squares
dragons.

【在 n*****t 的大作中提到】
: You are at square [0, 0] of an n*n grid. There is $1,000,000 on square [n - 1
: , n - 1]. Your goal is to reach that square and take the money. You can
: traverse the grid only by going to the square to the right, left, up or down.
: Unfortunately some squares have killer monsters. Entering any of these squares
: means a slow and painful death. There are no killer monsters on [0, 0] and [n
: - 1, n - 1]. Other squares have greedy dragons. To enter any of these squares
: you must pay a $1000. You have borro

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。