求问错误原因,只对了三个点..求神牛牪犇解答
var a,b,c,d,e,f,g,h:longint; x,y,z:array[1..30000]of longint; begin assign(input,'chorus.in');reset(input); assign(output,'chorus.out');rewrite(output); read(a); for b:=1 to a do read(x[b]); for c:=1 to a do begin for d:=1 to c-1 do if (x[d]<x[c]) then if y[d]>h then h:=y[d]; y[c]:=h+1; h:=0; end; for c:=a downto 1 do begin for d:=c+1 to a do if x[d]<x[c] then if z[d]>g then g:=z[d]; z[c]:=g+1; g:=0; end; for e:=1 to a do if y[e]+z[e]-1>f then f:=y[e]+z[e]-1; write(a-f); end.
题目 109 [NOIP 2004]合唱队形
2013-11-05 22:43:06
|
|
秒了.........
题目 560 细胞个数
2013-09-23 23:06:17
|
|
全排列咋写来着,求思想
题目 183 [USACO Oct08] 奶牛的骰子
2013-09-22 22:04:16
|
|
求神牛解答,为什么有三个点是E
var a,b,c,d,e,f,g,h,i:longint; y:array[1..3,1..5000]of int64; begin assign(input,'elect.in'); reset(input); assign(output,'elect.out'); rewrite(output); read(a,f); for b:=1 to a do begin read(y[1,b],y[2,b]);y[3,b]:=b;end; begin for c:=1 to f do for d:=c+1 to a do if y[1,c]<y[1,d] then begin e:=y[1,c];y[1,c]:=y[1,d];y[1,d]:=e; e:=y[2,c];y[2,c]:=y[2,d];y[2,d]:=e; e:=y[3,c];y[3,c]:=y[3,d];y[3,d]:=e; end; for g:=1 to f do if h<y[2,g] then begin h:=y[2,g];i:=y[3,g];end; end; write(i); close(input);close(output); end. |