Leetcode: 【每日一题】- 2020-03-25 - 足球排球和篮球

Created on 25 Mar 2020  ·  4Comments  ·  Source: azl397985856/leetcode

一个班级60%喜欢足球,70%喜欢篮球,80%喜欢排球,问:三种球都喜欢占比最大可能有多少,最小可能有多少?即求三种球都喜欢的比例范围

Daily Question Easy stale 概率

Most helpful comment

(1)首先确定最多的一种情况,就是 60% 喜欢足球的人同时也喜欢篮球和排球,此时为三种球都喜欢的人的最大比例。

(2)然后确定最小的一种情况,根据题目可以知道有 40%的人不喜欢足球,30%的人不喜欢篮球,20%的人不喜欢排球,因此有最多 90% 的人三种球中有一种球不喜欢,因此三种球都喜欢的人的最小比例为 10%。

算法:

  • 首先考虑60 和 70, 都喜欢的比例最少是 (70 + 60 - 100) = 30
  • 然后30 和 80 结合,为 (30 + 80 - 100) = 10

总的来说就是(70 + 60 - 100) + 80 - 100 = 10

因此三种球都喜欢的人占比为 10%-60%

All 4 comments

(1)首先确定最多的一种情况,就是 60% 喜欢足球的人同时也喜欢篮球和排球,此时为三种球都喜欢的人的最大比例。

(2)然后确定最小的一种情况,根据题目可以知道有 40%的人不喜欢足球,30%的人不喜欢篮球,20%的人不喜欢排球,因此有最多 90% 的人三种球中有一种球不喜欢,因此三种球都喜欢的人的最小比例为 10%。

算法:

  • 首先考虑60 和 70, 都喜欢的比例最少是 (70 + 60 - 100) = 30
  • 然后30 和 80 结合,为 (30 + 80 - 100) = 10

总的来说就是(70 + 60 - 100) + 80 - 100 = 10

因此三种球都喜欢的人占比为 10%-60%

三球都喜欢的最大值为50%
最小值为:30%

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

三球都喜欢的最大值为50%
最小值为:30%

why

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azl397985856 picture azl397985856  ·  4Comments

azl397985856 picture azl397985856  ·  3Comments

azl397985856 picture azl397985856  ·  5Comments

azl397985856 picture azl397985856  ·  3Comments

azl397985856 picture azl397985856  ·  3Comments