# [Community Puzzle] Kiss the girls

Coding Games and Programming Challenges to Code Better

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)

4 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

Hi to All, and thanks @xujun117 for your quick â€śprobability lessonâ€ť â€¦
â†’ got it too !

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

all have been said ;-).

1 Like