Task 59 Bulls and Cows

Back to Problem Solutions forum

Mbapathe     2016-11-03 09:39:46

Here is the link to screenshot as a proof (dropbox, https://goo.gl/o07MF4)

main number is 1743

test number is 8213

We have two right digits - 1 (correct, but wrong position) & 3 (correct digit and position), so I expected the result of comparing should be '1-2', but instead I recieved that program expects right answer as '1-1'

What's wrong with me?

P.S. For example if we compare 1743 & 1258 we recieve right result '1-1' (we have only one digit 1 with right position)

Quandray     2016-11-03 10:18:47
User avatar

Hi,

The problem description says

The hint consists of two values:

    first tells how many digits are guessed correctly and are in correct positions;
    second tells how many digits are guessed correctly but are in wrong positions.

For example, if the secret value is 1492 and Barbara's guess is 2013 - Alice should answer with 0-2.
And if the guess is 1865, then the hint would be 1-0.

For 1743 and 8213 the expected answer is 1-1 because the '3' is guessed correctly and in the correct position. The '1' is guessed correctly but in the wrong position.

For 1743 and 1258 the expected answer is 1-0 because only the '1' is correct.

Mbapathe     2016-11-03 11:26:05

Ha! It seems I played in this game with the wrong rules) How I understand - all correct digits are a sum of digits with right and wrong positions.

In my past all correct digits placed on the right side in the pair of answers

Please login and solve 5 problems to be able to post at forum