Question: C++ use of data structures if possible Coin flipping easy game Tom is playing the coin flipping game. In the game, there is a rectangular
Coin flipping easy game Tom is playing the coin flipping game. In the game, there is a rectangular grid of coins, with heads-1 and tails = 0. The game has one simple rule: the player gannot flip a single coin, instead, the player can choose one row (or one column) and flip all the coins in that row (or that column) simultaneously. The objective of the game is to find out a strategy to flip the coins so that the number of head coins is maximized. Can you write a program to help Tom to win this game? Here is an example: 0010 1101 1101 1001 1001 1011 | Flip the second and 1011 1011 1101 0110 0110 1011 Flip the first third and fourth rows 1101 Total = 17 heads third columns The grid has 5 rows and 4 columns with 20 coins in total. The best strategy is to flip the first third and fourth rows, and then flip the second and third columns, and finally there are 17 head coins. Coin flipping easy game Tom is playing the coin flipping game. In the game, there is a rectangular grid of coins, with heads-1 and tails = 0. The game has one simple rule: the player gannot flip a single coin, instead, the player can choose one row (or one column) and flip all the coins in that row (or that column) simultaneously. The objective of the game is to find out a strategy to flip the coins so that the number of head coins is maximized. Can you write a program to help Tom to win this game? Here is an example: 0010 1101 1101 1001 1001 1011 | Flip the second and 1011 1011 1101 0110 0110 1011 Flip the first third and fourth rows 1101 Total = 17 heads third columns The grid has 5 rows and 4 columns with 20 coins in total. The best strategy is to flip the first third and fourth rows, and then flip the second and third columns, and finally there are 17 head coins
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
