[Community Puzzle] Kiss the girls

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Westicles,validated by @emh,@FredericLocquet and @pluieciel.
If you have any issues, feel free to ping them.

Hi @Westicles
I must be missing something in the probability function.
How a number divided by its own square + 1 can be greater than 0.4 ?

Hi @LudovicB, that is the odds for one girl. So if it is less than 0.4 he might be able to kiss some more.

The statement is not clear.
Should we have to find the best dot from where we can have the most possible G’s?

1 Like

You want to kiss as many girls as possible without having more than a 40% chance of catching monkeypox, like it says.

But how?
We must be next to a girl to kiss her.

I think my program is good, but differences appears with tests results as the number of G increases.
Could we have here or in the description an example of intermediate calculus for the first test ?
Thx for the Puzzle

This is basic probability calculation.

Given two dice.
One die has one face painted 1.
Another die has two faces painted 1 (obviously this is a non-regular die).

Throwing these two dice together, what is the P of getting “at least one 1”?

“Getting 1” means getting infected in the problem.

I’m sorry, but I don’t get the link with the “Kiss the girls” problem, no dices here.

getting 1 on die k means infected by girl k. (Pk)
so you calculate the odd of not infected. (1-Pk)
you go through different dice, and keep not having any 1. and the complement of that is getting “at least one 1”.

1 Like

For the first test i obtain this sorted results for each girl ,it is ok or i’m wrong?
0,
0,
0,
0.05555555555555555,
0.05555555555555555,
0.09803921568627451,
0.12121212121212122,
0.14285714285714285,
0.14285714285714285,
0.15789473684210525,
0.2222222222222222,
0.3333333333333333

1 Like

As far as I remember, your results are right.

Thx all, I was misreading the statement.

P(A+B)=P(A)+P(B)-P(A)*P(B)

5 Likes

Not all problems are best solved by programming/math.
I’m sure the girls on the edges (where x = 0 or y = 0) are all perfectly nice, fine girls… but that’s not enough for Bob… Bob has to have more.
That is all.

Nice puzzle. I learned from it. Thanks.

2 Likes

@nicola (or anyone),

I am calculating those same values that @frayth posted earlier, but I am getting 7 as the most girls to kiss. And when I do the math using this list and starting at the top, when I get to the 8th value and add the first value that starts with .14, it is then adding up to .47, so I don’t count that girl. How do you get 8 from that list of values? I’m clearly missing something, but I just can’t figure out what it could be.

You can’t just add them, otherwise the odds of getting at least one head in two coin flips would be 100%.

1 Like

Thanks @Westicles. That finally put it in place for me. Just passed all test cases and validators.

Statistics and probability were never one of my strongpoints.

And I’ve never been to a rave.

1 Like

You should definitely go to one sometime :rofl:

:wave: Hi to All, and thanks @xujun117 for your quick “probability lesson” :wink: …
→ got it too :+1: !

=> Thanks a lot for your help, and to the author @Westicles too :handshake:.
As @Lisa-Has-Ideas said :

all have been said ;-).

1 Like