Page 1 of 1

C++

Posted: Sun May 15, 2022 10:19 am
by answerhappygod
C++
C 1
C 1 (60.73 KiB) Viewed 35 times
C 2
C 2 (62.09 KiB) Viewed 35 times
C 3
C 3 (24.08 KiB) Viewed 35 times
Overview Super Mario is on the run collecting coins. In level # 1, whenever he takes a coin, the next coin is automatically blocked with an iron brick. Which coins should Mario take in order to maximize his gains? $3 $9 $2 $7 $3 $6 $9 $1 O 3$ 6$ = $25 skip Take Take $7 skip Take $9 $9 3$ = $23 skip Take $9 Take Take $6 $7 Take 1 LA

Overview In level #3, the same rules of level 1 apply with an extra rule: If Mario picks a coin that is directly before a grass segment, all the coins on that grass segment are blocked with iron bricks. Which coins should Mario take in order to maximize his gains? $8 $9 $1 $7 $3 $6 $9 $8 OO $2$3 S4 $1 OOO $1 $1 O O $8 $1 $6 = $32 Take $9 Take $2 Take Take S7 Take Take $1 = $21 Take $8 Take 58 Take $1 Take $3 Take 51 $1 $6 = $33 Take SB Take $8 Take Take 59 Take $7 51

Requirements Implement the following function: unsigned max_coins (vector<unsigned coins, string terrain) In addition to the coins vector (as in the previous exercise), the function receives a string describing the terrain, where 'g' means grass and 'b' means a brown brick. Example. The terrain in the above example is described by the following string: "bbbggggbbbgggb"