HBC24861B是不是太迟了,字符串,语言题[USACO 2009 Nov G]Cow Rescue题解

爱的那么颓废 算法基础篇 49 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
Bessie is trapped in a triangular maze with N rows (1

Bessie is trapped in a triangular maze with N rows (1 <= N <= 1,000,000). A three row maze is shown below: The i'th row of the maze contains 2*i-1 triangles. Numbering from the left, the triangles are named (i,1), (i,2), and so on. Bessie can travel to the (often three) triangles which share an edge with her current triangle. For example, if she is at (3, 3), she can travel to (3, 2), (3, 4) and (4, 4). Bessie takes one minute to travel from one triangle to the next. FJ has learned the Bessie is trapped and knows by tracking her iPhone that she starts her exit trek at triangle (Si,Sj). FJ's love for Bessie knows no bounds so he wants her back in the minimum possible time. The maze has M (1 <= M <= 10,000) exits found in locations throughout the set of triangles. Any one of these will enable Bessie to escape. Once she enters an exit triangle, she leaves the maze in just one more minute. Find the minimum time in minutes, T, required for Bessie to exit the maze and report the optimal exit location she uses, (OUTi, OUTj). If more than one location requires only T minutes, output the location with the smallest row. If two optimal rows are the same, output the one with smaller column.

HBC24861B是不是太迟了,字符串,语言题[USACO 2009 Nov G]Cow Rescue题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC24861B是不是太迟了 字符串 语言题[USACO 2009 Nov G]Cow Rescue题解