In the new intellectual TV show, the participant passing to the super final is offered the following game: the letter of the Latin alphabet li is written on each of the n sectors of the big drum. After a minute of reflection, the player indicates one of the positions on drum i. Its gain is calculated according to the following rule: for each position j, the smaller of the distances clockwise and counterclockwise from i to j, measured in sectors, is multiplied by the absolute value of the difference of numbers in the alphabet of letters li and lj, after which all such values are summed. |
PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code. Along with the proper indenting it makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ Hint: You can edit your post, highlight your code and press the <> formatting button. You can use the preview button at the bottom to see how it looks. I found the second link to be the most help. |
Can you write a program that finds a way to get the most winnings? |
|
|