/ Vijos / 讨论 / 过河 /

那错了才50分啊啊啊

program qq;

var f:array[0..1000000]of integer;

a:array[1..1000000]of integer;

z,n,c,b,l,i,j,m,t,s:integer;

function min(x,y:integer):integer;

begin

if x>y

then begin

n:=y;

end

else begin

n:=x;

end;

min:=n;

end;

begin

fillchar(f,sizeof(f),101);

f[0]:=0;

readln(l);

readln(s,t,m);

for i:=1 to m do

begin

read(b);

a:=1;

if z

1 条评论

  • @ 2014-03-03 18:31:29

    var i,j,n,m,s,t,k,ans,l,x:longint;
    a:array[0..200]of longint;
    y:array[0..2000000]of boolean;
    f:array[0..2000000]of longint;

    procedure sort(l,r: longint);
    var
    i,j,x,y: longint;
    begin
    i:=l;
    j:=r;
    x:=a[(l+r) div 2];
    repeat
    while a[i]<x do
    inc(i);
    while x<a[j] do
    dec(j);
    if not(i>j) then
    begin
    y:=a[i];
    a[i]:=a[j];
    a[j]:=y;
    inc(i);
    j:=j-1;
    end;
    until i>j;
    if l<j then
    sort(l,j);
    if i<r then
    sort(i,r);
    end;

    begin
    readln(l);
    readln(s,t,m);
    for i:=1 to m do read(a[i]);
    a[m+1]:=l;
    sort(1,m);

    if s=t then begin for i:=1 to m do if a[i]mod s=0 then inc(ans); writeln(ans); end
    else
    begin
    for i:=1 to m+1 do
    if a[i]-a[i-1]>s*t then
    begin
    x:=a[i]-a[i-1]-s*t;
    for j:=i to m+1 do
    a[j]:=a[j]-x;
    end;
    l:=a[m+1];
    for i:=1 to m do y[a[i]]:=true;
    for i:=1 to l do f[i]:=100000;
    for i:=1 to l do
    for j:=s to t do
    if i-j>=0 then

    if y[i] then
    begin
    if f[i-j]+1<f[i] then f[i]:=f[i-j]+1;
    end
    else if f[i-j]<f[i] then f[i]:=f[i-j];

    writeln(f[l]);
    end;
    end.

    看能不能帮上忙?

  • 1

信息

ID
1002
难度
7
分类
动态规划 点击显示
标签
递交数
25264
已通过
4390
通过率
17%
被复制
76
上传者