i=j−1
X
i=1
oi∗ai=
i=j−1
X
i=1
gi∗ai+ (gj−oj)∗aj≥(gj−oj)∗aj≥aj
oi1≤i≤j−1d
i=j−1
X
i=1
oi∗ai≤
i=j−1
X
i=1
(d−1) ∗ai≤(d−1) ∗
i=j−1
X
i=1
ai
Pi=j−1
i=1 ai=Pi=j−1
i=1 di−1=Pi=j−2
i=0 di= (dj−1−1)/(d−1) Pi=j−1
i=1 oi∗ai≤dj−1−1< aj
j= 1
i1≤i≤j−1oid o0
o0
l=oll i i + 1 o0
i−1=oi−1o0
i=oi−d, o0
i+1 =oi+1 + 1
o0o o
g=o g
diR+k∗di
•
d−1aii < n
d d
on=s%d, on−1= (s div d)%d, ..., ..., o1=s div dn−1
•d
O(S∗n)
Eff(S, Syst)S
S
•ap
S < apS a1, ..., ap−1
S≥apap
Eff(S, Syst, k)S k
Syst
Eff(S, Syst, p) = Eff(S, Syst, p −1) S < ap
Eff(S, Syst, p) = min(Ef f(S, Syst, p −1),1 + Eff(S−ap, Syst, p)) S≥ap
Eff(0, Syst, p) = 0
Eff(S, Syst, 1) = S a1= 1
0S
1n
•ap
ap0S/ap
Eff(S, Syst, p) = min0≤k≤s/ap(k+Ef f(S−k∗ap, Syst, p −1)).
Eff(S, Syst, p) = min(Ef f(S, Syst, p −1), S/ap+Eff(S%ap, p))
{1,3,4}S= 10 4 0 2