Trivial solution to the Continuous Knapsack problem
Briefly, the supply of each material is finite: there is only $w_i$ of material $i$. If $w_i &lt; W$, then you cannot fill the knapsack just with material $i$.

In the continuous (or fractional) knapsack problem, we are given a bunch of materials $1,\ldots,n$. Material $i$ has weight $w_i$ and total value $v_i$. The goal is to pick $\alpha_1,\ldots,\alpha_n \in [0,1]$ such that $\sum_i \alpha_i w_i \leq W$ in a way which maximizes $\sum_i \alpha_i v_i$. Your suggestion of taking $\alpha_i = W/w_i$ (for the best material $i$) is only feasible and optimal if $W = w_i$. If $W &gt; w_i$ then the choice isn't feasible – there is not enough of material $i$. If $W &lt; w_i$, then the choice (probably) isn't optimal, since the knapsack will still have room left.