vj1144 小胖守皇宫

Vj1144 小胖守皇宫

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

View Full Document Right Arrow Icon
//±ÉÈ˵ķ½·¨ //Ê÷ÐÍdp //×¢Òâ·ÖÀà //ÿ¸ö½áµã¿´ÊØÇé¿öÓÐÈý£º¸¸½áµã ×Ô¼º ×Ó½áµã Éè·Ö±ðΪ f[i,0] f[i,1] f[i,2] //f[i,0]=sum( min( f[j,1] , f[j,2] ) ) //f[i,1]=sum( min( f[j,0] , f[j,1] ,f[j,2] ) ) + cost[i] //f[i,2]=sum( min( f[j,1] , f[j,2] ) ) + min( f[k,1] - min( f[k,1] , f[k,2] ) ) ×Ó½áµãÖбØÐëµÃ·ÅÒ»¸ö //ans=min( f[root,1] , f[root,2] ) / const maxn=1500; var n,root:integer; cost,total:array[0. .maxn] of integer; f:array[0. .maxn,0. .2] of longint; son:array[0. .maxn,0. .maxn] of integer; v:array[0. .maxn] of boolean; function min(x,y:longint):longint; begin if x<=y then exit(x); exit(y); end; procedure init; var i,j,x:integer; begin readln(n); for i:=1 to n do begin read(x); read(cost[x]); read(total[x]);
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.

This note was uploaded on 02/21/2011 for the course CS 001 taught by Professor 001 during the Spring '11 term at Shandong University.

Page1 / 2

Vj1144 小胖守皇宫

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