# 中山培训 2016.7.11

Description

Input

Output

Sample Input

2

100 100

50 50

2

0 50

50 0

3

25 60 100

13 0 50

12 70 90

Sample Output

50.000000

25.000000

9.100000

const

maxn=1048575;

var

b:array[1..20] of longint;

f:array[0..maxn] of real;

s:array[0..20,0..20] of real;

a:array[1..20] of longint;

n,i,l,j,k,m,s1,t:longint;

function max(a,b:real):real;

begin

if a>b then max:=a

else max:=b;

end;

begin

fori:=1 to n do

forj:=1 to n do

b[1]:=1;

f[0]:=100;

fori:=2 to n do

b[i]:=b[i-1]*2;

fori:=1 to b[n] shl 1-1 do

begin

t:=0;

s1:=0;

for j:=1 to n do

if i and b[j]>0 then

begin

inc(s1);

a[s1]:=j;

inc(t);

end;

for j:=1 to s1 do

f[i]:=max(f[i-b[a[j]]]*s[a[j],t]/100,f[i]);

end;

write(f[b[n]shl 1-1]:0:6);

end.

const

maxn=1048575;

var

b:array[1..20] of longint;

f:array[0..maxn] of real;

s:array[0..20,0..20] of real;

a:array[1..20] of longint;

n,i,l,j,k,m,s1,t:longint;

function max(a,b:real):real;

begin

if a>b then max:=a

else max:=b;

end;

begin

fori:=1 to n do

forj:=1 to n do

b[1]:=1;

f[0]:=100;

fori:=2 to n do

b[i]:=b[i-1]*2;

fori:=1 to b[n] shl 1-1 do

begin

t:=0;

s1:=0;

for j:=1 to n do

if i and b[j]>0 then

begin

inc(s1);

a[s1]:=j;

inc(t);

end;

for j:=1 to s1 do

f[i]:=max(f[i-b[a[j]]]*s[a[j],t]/100,f[i]);

end;

write(f[b[n]shl 1-1]:0:6);

end.

• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120