HBC51171不找零钱,过关题目,语言题Polygon题解 (polygonisagameforone)

为你而来永不停止 算法基础篇 51 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Polygon is a game for one player that starts on a polygon with N vertices, like the one in Figure 1, where N=4. Each vertex is labelled with an integer and each edge is labelled with either the symbol + or the symbol * . The edges are numbered from 1 to N. On the first move, one of the edges is removed. Subsequent moves involve the following steps: pick an edge E and the two vertices V1 and V2 that are linked by E; and replace them by a new vertex, labelled with the result of performing the operation indicated in E on the labels of V1 and V2. The game ends when there are no more edges, and its score is the label of the single vertex remaining. Consider the polygon of Figure 1. The player started by removing edge 3. After that, the player picked edge 1, then edge 4, and, finally, edge 2. The score is 0. Write a program that, given a polygon, computes the highest possible score and lists all the edges that, if removed on the first move, can lead to a game with that score.

Polygon is a game for one player that starts on a polygon with N vertices, like the one in Figure 1, where N=4. Each vertex is labelled with an integer and each edge is labelled with either the symbol + (addition) or the symbol * (product). The edges are numbered from 1 to N.  On the first move, one of the edges is removed. Subsequent moves involve the following steps:  pick an edge E and the two vertices V1 and V2 that are linked by E; and  replace them by a new vertex, labelled with the result of performing the operation indicated in E on the labels of V1 and V2.  The game ends when there are no more edges, and its score is the label of the single vertex remaining.  Consider the polygon of Figure 1. The player started by removing edge 3. After that, the player picked edge 1, then edge 4, and, finally, edge 2. The score is 0.  Write a program that, given a polygon, computes the highest possible score and lists all the edges that, if removed on the first move, can lead to a game with that score. 

HBC51171不找零钱,过关题目,语言题Polygon题解
(polygonisagameforone)-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC51171不找零钱 过关题目 语言题Polygon题解