Answer:
Following are attached images that will help you understand the complete code. The code is tested with different variables and different outputs are obtained. All the necessary description is given in the form o comments inside the code.
Explanation:
The simulation, player 2 will always play according to the same strategy.
Method getPlayer2Move below is completed by assigning the correct value to result to be returned.
Explanation:
- You will write method getPlayer2Move, which returns the number of coins that player 2 will spend in a given round of the game. In the first round of the game, the parameter round has the value 1, in the second round of the game, it has the value 2, and so on.
#include <bits/stdc++.h>
using namespace std;
bool getplayer2move(int x, int y, int n)
{
int dp[n + 1];
dp[0] = false;
dp[1] = true;
for (int i = 2; i <= n; i++) {
if (i - 1 >= 0 and !dp[i - 1])
dp[i] = true;
else if (i - x >= 0 and !dp[i - x])
dp[i] = true;
else if (i - y >= 0 and !dp[i - y])
dp[i] = true;
else
dp[i] = false;
}
return dp[n];
}
int main()
{
int x = 3, y = 4, n = 5;
if (findWinner(x, y, n))
cout << 'A';
else
cout << 'B';
return 0;
}
Answer:
1. =CONCATENATE(" John"," ","Smith")
2. =(" John"&" "&"Smith")
Explanation:
Given
Two separate strings; "John" and "Smith"
Required
2 separate formulas to concatenate both strings to form " John Smith"
There are several ways to concatenate strings in Microsoft Office Excel; one of the methods is using the concatenate function while the another method is using the traditional & operator.
Using the concatenate function, the formula is as follows
=CONCATENATE(" John"," ","Smith")
This function will combine the " John", " " and "Smith" to give a new string " John Smith" (without the quotes).
Using the traditional & operator may be a little bit difficult (and not frequently used) but the formula is as follows;
=(" John"&" "&"Smith")
The result will be the same as (1) above
Answer:
Answer is A: place absorbent chemical packets in the camera cover
Explanation:
Keith is required to carry adequate gear while going for a shoot. And in this case, he should carry anything that will protect his camera from the ocean and rainwater. By anything, I mean anything that Keith will use to stay dry. Using an air conditioner would be the worst idea. An air conditioner might blow the air towards your camera. Placing the camera in its case will ensure that it is dry and Keith will keep on shooting. Placing absorbent chemical packets in the camera cover will ensure that any water droplets that might fall on the cover of the camera will be absorbed. The point here is to keep dry.
<span>make periodic adjustments on an as-needed basis. </span>