第四个点wa[p党]

P1478 陶陶摘苹果(升级版)

Tarensev @ 2017-10-01 09:54:29

样例输入输出都对,为什么第四个点过不了?

给个数据呗

type stype=record
            high,might:longint;
           end;
var a:array[1..5000] of stype;
    temp:stype;
    n,s,sum,i,j,c,h:longint;
begin
 readln(n,s);
 readln(c,h);
 sum:=0;
 for i:=1 to n do
  with a[i] do
   readln(high,might);
 for i:=1 to n do
  for j:=1 to n-i do
   if a[j].might>a[j+1].might then
    begin
     with temp do
      begin
       high:=a[j].high;
       might:=a[j].might;
      end;
     with a[j+1] do
      begin
       a[j].high:=high;
       a[j].might:=might;
       high:=temp.high;
       might:=temp.might;
      end;
    end;
 i:=1;
 while s>=a[i].might do
  begin
   if a[i].high<=c+h then
    begin
     sum:=sum+1;
     s:=s-a[i].might;
    end;
   i:=i+1
  end;
 writeln(sum);
end.

by Tarensev @ 2017-10-01 10:18:04

然而第四个点是0

此楼已作废


by zxxdxlh @ 2017-10-03 14:40:40

23333 0?


by 万万 @ 2017-10-10 19:59:09

为什么我只过了第四个点


by 万万 @ 2017-10-10 20:00:04

查看题解


by 跃动の光は @ 2017-12-10 12:01:00

第四个点有###毒啊(需要加特判)


|