vj1100 加分二叉树

Vj1100 加分二叉树

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//±ÉÈ˵ķ½·¨ //dp //Éè f[i,j] ±íʾÖÐÐò±éÀú´Ó i µ½ j µÄ×î´ó¼Ó·Ö ͨ¹ýö¾Ù¸ù½Úµã¼ÆËã //f[ i , j ] = max( f[ i , k-1 ]*f[ k+1 , j ] + score[ k ]) (i<=k<=j) ³õÖµ f[i,i-1]=1 f[i+1,i]=1 (1<=i<=n) //µÚ¶þÎʼǼ root[ i , j ] ±íʾ i µ½ j ×î´ó¼Ó·ÖµÄ¸ù½Úµã µÝ¹éÊä³ö / const maxn=30; var n:integer; score:array[0. .maxn] of integer; f:array[0. .maxn,0. .maxn] of longword; root:array[0. .maxn,0. .maxn] of integer; procedure init; var i:integer; begin readln(n); for i:=1 to n do read(score[i]); end; procedure main; var i,j,k,l:integer; tmp:longword; begin for i:=1 to n do f[i,i-1]:=1;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Vj1100 &aring;Š&nbsp;&aring;ˆ†&auml;&ordm;Œ&aring;‰&aelig;&nbsp;‘

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online