https://www.codingame.com/training/medium/guessing-digits
Send your feedback or ask for help here!
Created by @Jamproject,validated by @JBM,@crashtestdummy and @Jakque.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/medium/guessing-digits
Send your feedback or ask for help here!
Created by @Jamproject,validated by @JBM,@crashtestdummy and @Jakque.
If you have any issues, feel free to ping them.
I don’t get why it got so many downvotes, it’s a nice puzzle.
Continuing the discussion from [Community Puzzle] Guessing digits:
I don’t understand this task!
What mean " asks Burt if he knows a and b" - Burt try random or try find one by one…
i use to for loop but it seems to be wrong idea.
I don’t understand who find this a and b
The name is slightly misleading as guessing isn’t allowed. They either know the exact digits or have to say they don’t know. As they both start with different information saying that they don’t know tells the other person something so at some point there is only one pair of digits or it’s impossible.
Example: numbers are 2 and 5
Turn 1
Burt is given 7, there are multiple combinations that give a sum of 7 so he doesn’t know which one.
Sarah is given 10, the only combination is 2*5 so she can find out.
Now, let’s consider another example where Burt is given 7. If Sarah doesn’t find the digits on turn 1, then Burt knows for sure that the combination is not (2, 5).
By filling a big chart with the history of what can be discovered at each turn, it kills possibilities turn after turn and some of them become findable at some point.
Indeed, it’s a smart one. But it needs more explainations. Without yours, I would have skip the puzzle.
Hi,
I am having a hard time solving this puzzle, and I think I need a little bit more information. Here is what I understand after reading the problem description:
Maggie picks two digits a
and b
with 1 ≤ a
≤ 9, 1 ≤ b
≤ 9, and a
≤ b
.
She writes their sum on a blue piece of paper, folds it, and says “Here is the sum of the two digits I chose” while handing it to Burt.
She then writes their product on a red piece of paper, folds it, and says “Here is the product of the two digits I chose” while handing it to Sarah.
Burt and Sarah do not share the contents of their respective pieces of paper.
The game is played in rounds.
In each round, Burt plays first by announcing his guess for (a
, b
), in this case (n
, m
).
n
,m
) BURT round number
"p
,q
).p
,q
) SARAH round number
".If any of the players is out of guesses when his/her turn comes, the game ends with “IMPOSSIBLE”.
Did I understand correctly?
Not exactly, there are no “guesses”, either the player knows for sure what (a, b) is and tells it, or the players doesn’t say anything and we move to the next player.
So a typical game would look more like this:
B: “I don’t know”
S: “I don’t know”
B: “I don’t know”
S: “I don’t know”
B: “I don’t know”
S: “I know, it’s a = … and b = …”
Which might be a bit disturbing but that’s how it is ^^
Ok, let me try again (-_-)>.
So before the game starts, let say Ώ is the set of possible pairs (a
,b
) such that 1 ≤ a
≤ 9, 1 ≤ b
≤ 9, and a
≤ b
.
Maggie chooses an element (a
, b
) of Ώ and gives respectively the values s
= a
+ b
and p
= a
* b
to Burt and Sarah.
Knowing s
, Burt can narrow down Ώ to a subset S of possible solutions.
Sarah can also determine a subset P of Ώ from the value of p
.
The game is played in rounds. In each round, Burt plays first.
If Burt is certain of knowing the answer |P| = 1 (i.e. P contains only one element) he announces it and the game ends, otherwise he passes his turn.
Sarah can then announce her answer if |S| = 1 or passes.
If both pass their turn, we proceed to the next round.
The fact that Burt/Sarah passes his/her turn should help his/her opponent further narrow down his/her set of possible solutions.
Am I getting warmer?
Yes it’s exactly that.
It’s all about “if it was a = …, b = … he would have figured out by this turn and he didn’t, so it’s not that, let’s remove this one”.
Gosh! I would have been really deep in the weeds, without your assistance.
Now that I have a better understanding of the basic premise of this puzzle, time for the hard part…solving it!
You saved me from a huge headache, thanks! (^_^)b
Right, But the description doesn’t say how Sarah and Burt proceed to guess the numbers. (random or trying for the minor number to the greater, or from the greater combination to the minor one).
It’ s the worst puzzle description I ever seen.
It is the problem of Freudenthal. It is a difficult problem.
The problem with this task is that this puzzle has some wrong assumptions and errors in my opinion e.g.
This puzzle deals with recursive logics, it’s not an easy concept.
There’s nothing wrong about the statement, it’s just that you didn’t understand the concept.
Maybe try an easier one, or if you really want to solve it, the first task is to understand why you are wrong, and I can try to explain it for you but you’ll learn more if you do the whole process yourself.
I write specifically for those who avoid tasks with a low rating:
I have now solved this puzzle.
This is an interesting challenge.
At 90% this is a logic problem, I had to think carefully about what was happening.
The programming of the solution itself is not difficult.
Straight up trash.
When the numbers are 1 and 9 the outpuit “shouls” be impossible???$
How cna bart not guess it??
dogshit puzzle and awful explanation… question yourself
You may criticise the puzzle, but please tone down your language.