ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1193. Queue at the Exam

I have found some bugs but still WA, plz help.
Posted by Ural_Happy New Year! 19 May 2003 19:47
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
Posted by ural_li yubo 19 May 2003 20:26
> 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!!!
Posted by Ural_Happy New Year! 20 May 2003 19:27
Re: Are you qi xian
Posted by Ural_xu zhanpeng 20 May 2003 19:32
>
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!(-)
Posted by Ural_Happy New Year! 22 May 2003 17:52