← 返回 stripe 的题目列表Find Cheapest Shipping Route with Up to One Transfer
类型:online_judge
stripe
Shipping Route Problem
Given an input string representing shipping routes like '{source}:{target}:{method}:{cost}'. Write functions to return the desired information such as the cost, route, or cheapest route.
Given a source country and a target country, return the path, method, and cost of traveling.
Example Input: "{OS}:{L}:{FA}:{5},{S}:{C}:{AH}:{3},{C}:{X}:{MR}:{4}"
Example Output: Path=['{OS}', '{L}'], Method=['{FA}'], Cost=5
Given a source country and a target country, return the path, method, and cost of traveling if one transfer can be made.
Example Input: "{S}:{F}:{PL}:{2}"
Example Output: Path=['{S}', '{F}'], Method=['{PL}'], Cost=2
Given a source country and a target country, return the path, method, and cheapest route of traveling if one transfer can be made.
Example Input: "{N}:{O}:{RC}:{3},{A}:{B}:{HC}:{1},{Y}:{Z}:{HT}:{5}"
Example Output: Path=['{A}', '{B}'], Method=['{HC}'], Cost=1
Example
Input
{OS}:{L}:{FA}:{5},{S}:{C}:{AH}:{3},{C}:{X}:{MR}:{4},{L}:{Z}:{PR}:{2}
{OS}
{Z}