mirror of
https://github.com/Anduin2017/HowToCook.git
synced 2025-12-18 03:04:23 +08:00
Update 如何选择现在吃什么.md
This commit is contained in:
14
如何选择现在吃什么.md
14
如何选择现在吃什么.md
@@ -11,6 +11,20 @@
|
||||
|
||||
由此得到荤菜数量和素菜数量,再在上一步的菜谱中选择即可。
|
||||
|
||||
#### 形式语言描述
|
||||
|
||||
当 有人数 `N` 时,
|
||||
设 `素菜数` 为 `a`, `荤菜数`为 `b`。
|
||||
`N`, `a`, `b`均为整数。
|
||||
|
||||
此时有下列不等式组:
|
||||
|
||||
* a + b = N + 1
|
||||
* b >= a
|
||||
* b <= a + 1
|
||||
|
||||
得到一组关于`a`, `b`的整数解即可。
|
||||
|
||||
### 菜的选择
|
||||
|
||||
* 如果人数超过8人,考虑在荤菜中增加鱼类荤菜。
|
||||
|
||||
Reference in New Issue
Block a user