or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
最大化平均值
目標:有n個物品可以選,每個物品都有價格v跟重量w,你要購買k個物品,價值為價格總和除以重量總和,求最大的價值為?
可以用二分搜尋找到最接近的數值(二分搜答案): x
式子1. \[\dfrac{∑v[i]}{∑w[i]}>=x\]
式子2. \[∑v[i]>=∑(x*w[i])\]
式子3. \[∑(v[i]-x*w[i])>=0\]
因此我們就可以利用式子3二分搜答案,如果成立的時候,代表最大值比x大,往比較大的去搜尋,否則往小的搜尋,直到誤差值小於EXP。