[Problem 36] Code Guessser

Back to Problem Solutions forum

Johni Limoni     2017-01-20 13:06:37
User avatar

Please explain me, how to find code in the number of guesses: 8327 0 0070 0 2681 2 1767 0 3976 0 9214 2 2271 2 4633 0 9500 1 Why the secret number is 9201 not a 2201 ? I do not understand how to get this secret number. Сan you give me any idea of solution ?

Quandray     2017-01-20 14:32:36
User avatar

Hi Johni,

I think something may have gone wrong with the numbers above, because the answer to input data

9
8327 0
0070 0
2681 2
1767 0
3976 0
9214 2
2271 2
4633 0
9500 1

is 9281.
It can't be 9201 because the 9 and a 0 match the "9500 1", so only one of those can be correct.
It can't be 2201 because the 2's and the 1 match "2271 2", so only two of those can be correct.

Johni Limoni     2017-01-20 15:19:11
User avatar

It can't be 2201 because the 2's and the 1 match "2271 2", so only two of those can be correct.

What do you mean? Explain a little bit easier please. English is not my native language, so I would like to make sure that I understood you correctly

Quandray     2017-01-20 15:43:00
User avatar

ok, sorry.

The 2 at the end of "2271 2" means that only two of the digits of that guess are correct.

2201 has three digits the same as 2271 (the 2, 2 & 1) so at least one of those three must be wrong.

Another way to look at it is that if 2201 was correct, 2271 should have been marked "2271 3".

Johni Limoni     2017-01-23 14:16:49
User avatar

After a few days solving this problem, I do not really understand how to determine a pattern by which we can determine the secret number.

Quandray     2017-01-23 14:54:42
User avatar

If we look at the example above

"8327 0" tells you that the first digit cannot be 8, the second digit cannot be 3, etc.

"2271 2" tells you that the correct answer must match exactly two of those digits,
so 9271, 2971, 2291, 2279 and a lots of others are excluded because they match three digits.
Also, 2345, 3245, 3475, 3451 and a lots of others are excluded because they match only one digit.

Does that help?

Johni Limoni     2017-01-23 16:26:13
User avatar

There is an example :

 8
8051 0
1432 1
5946 0
1495 1
5439 2
9737 1
8747 0
1179 2

If I take two numbers 1432 and 1495, it means I have to exclude 1495, because 1495 match two digits (1 and 4) ?

Johni Limoni     2017-01-23 18:50:41
User avatar

I understand what you're saying, but I can not find a link between the figures. As soon as I find any decision, it does not work for a different set of numbers.

Quandray     2017-01-23 20:53:20
User avatar

Try looking at it like this, with your latest example.
You know that the secret number is in the range 0000 to 9999.
Lets take each of those possibilities in turn.
It can't be 0000 because of "8051 0"
It can't be 0001 because of "8051 0"
It can't be 0002 because of "8051 0"
It can't be 0003 to 0099 because of "8051 0"
It can't be 0100 because of "1432 1"
Keep going until you find the number that none of the guesses and responses eliminates.

last_magic     2017-03-29 08:30:12
User avatar

Can I what am wrong, but sometimes for test incorrect test data example:

19 1770 1 3279 0 7911 0 0620 2 5187 0 7080 1 6805 0 3254 0 0344 0 5242 0 1532 1 2627 1 7155 0 1368 0 2635 0 9800 1 1547 1 7899 0 4316 0

The secret number 9520, but Test data one value 9800 1. This example got ony day

Quandray     2017-03-29 08:58:46
User avatar

For that example, the secret number is 8520, not 9520.

Jason Krasavage     2018-04-05 07:49:26
User avatar

[deleted]

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