|
|
back to boardI have found some bugs but still WA, plz help. program t1193; type types=record b:longint; l:longint; e:longint; end; var n,i,start:longint; t:array[0..100]of types; procedure sort; var j,i:integer; y:types; begin for i:=1 to n do for j:=i to n do if (t[i].b>t[j].b)or((t[i].b=t[j].b)and(t[i].e>t[j].e)) then begin y:=t[i]; t[i]:=t[j]; t[j]:=y; end; end; begin assign(input,'c:\pas\in.txt'); reset(input); readln(n); for i:=1 to n do readln(t[i].b,t[i].l,t[i].e); close(input); sort; start:=t[1].b; for i:=1 to n do begin start:=start+t[i].l; if t[i+1].b>start then start:=t[i+1].b; end; start:=start-t[n].e; if start>0 then writeln(start) else writeln(0); end. you are too hard > program t1193; > type types=record > b:longint; > l:longint; > e:longint; > end; > var n,i,start:longint; > t:array[0..100]of types; > procedure sort; > var j,i:integer; > y:types; > begin > for i:=1 to n do > for j:=i to n do > if (t[i].b>t[j].b)or((t[i].b=t[j].b)and(t[i].e>t [j].e)) > then > begin > y:=t[i]; > t[i]:=t[j]; > t[j]:=y; > end; > end; > begin > assign(input,'c:\pas\in.txt'); > reset(input); > readln(n); > for i:=1 to n do > readln(t[i].b,t[i].l,t[i].e); > close(input); > sort; > start:=t[1].b; > for i:=1 to n do > begin > start:=start+t[i].l; > if t[i+1].b>start then start:=t[i+1].b; > end; > start:=start-t[n].e; > if start>0 then writeln(start) > else writeln(0); > end. How poor ur English is!!! Re:My English is good!!!It's right!!!!! Posted by ACer 21 May 2003 17:42 > Don't waset ur time here, I have AC it, many thanks to Ural_xu zhanpeng!,and clever boy, ur English is poor,"you are too hard",haha!(-) |
|
|