讨论 / 求帮忙看看那里错啊
linzeyang1997 2013-10-22 03:54:00
点我顶贴 收藏 删除
各位大神帮帮我吧

program hotel;

type data=record

se:longint;

money:longint;

end;

var

n,se,money:longint;

a:array[1..2000000] of data;

e,i,j,p:longint;

procedure sum;

begin

e:=0;

for i:=1 to n do

for j:=1 to n do

if (i<>j) and (a[i].se=a[j].se)

then inc(e);

end;

function work(o:longint):longint;

var

r,l:longint;

begin

r:=0;

l:=0;

for i:=1 to n do

begin

r:=0;

p:=0;

for j:=1 to n do

begin

if (i<>j) and (a[i].se=a[j].se)

then if i>j then begin

p:=j;

repeat

if a[p].money<=money then r:=1;

inc(p);

until p=i+1;

end

else if i<j then begin

p:=i;

repeat

if a[p].money<=money then r:=1;

inc(p);

until p=j+1;

end;

if r=1 then inc(l);

end;

end;

work:=l;

end;

begin

readln(n,se,money);

for i:=1 to n do

readln(a[i].se,a[i].money);

sum;

writeln(work(e) div 2);

end.

查看更多回复
提交回复