Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎么才能过?总是显示Runtime Error

Posted by sqybi at 2005-08-09 23:46:41 on Problem 2497
In Reply To:steven is sure to win ? Posted by:william1089 at 2005-07-20 17:35:49
这个在TP,FP中都调试过,没问题啊?
{pascal}
{$N+}
program adsf;
type
  arr1 = array[1..24]of integer;
var
  text, i: integer;
  string1: Array[1..24]of string;
  s: string;
procedure ww(i: integer);
var
  alltime, problem, j, bill, bill1, linus, linus1, steve, steve1, o, o1: integer;
  time1: arr1;
  time2: arr1;
  time3: arr1;
function max(var time: arr1): integer;
var
  i, j, o: integer;
begin
  j:=1;
  for i:=0 to problem do
    if j<time[i] then begin j := time[i]; o:=i; end;
    time[o]:=0;
  max := j;
end;
procedure t1_2;
var
  i, j, o: integer;
begin
  for j:=1 to problem+1 do time2[j] := max(time1);
end;
procedure t2_3;
var
  i: integer;
begin
  for i:=1 to problem do time3[i]:=time2[problem+1-i];
end;
procedure try(time: array of integer; alltime: integer);
var
  i, j: integer;
begin
  i := 0;
  repeat
    dec(alltime, time[i]);
    inc(i);
  until (alltime-time[i]<0) or (i=problem);
  o:=i;
  for j:=0 to o-1 do o1:=o1+time[j];
end;
procedure print(o: integer);
var
  j: integer;
begin
  case o of
    1: begin string1[i]:='Steve wins with '; o:=steve; j:=steve1; end;
    2: begin string1[i]:='Linus wins with '; o:=linus; j:=linus1; end;
    3: begin string1[i]:='Bill wins with '; o:=bill; j:=bill1; end;
  end;
  str(o, s);
  string1[i] := string1[i] + s;
  string1[i] := string1[i] + ' solved problem';
  if o<>1 then string1[i]:=string1[i]+'s';
  string1[i]:=string1[i]+' and a score of ';
  str(j, s);
  string1[i] := string1[i] + s + '.';
end;
begin
  fillchar(time1, sizeof(time1), 0);
  fillchar(time2, sizeof(time2), 0);
  fillchar(time3, sizeof(time3), 0);
  read(alltime);
  read(problem);
  while (alltime<30) or (alltime>1440) or (problem<2) or (problem>24) do begin
    writeln('ERROR');
    read(alltime, problem);
  end;
  for j:=1 to problem do read(time1[j]);
  o1:=0;
  o:=0;
  try(time1, alltime);
  bill:=o;
  bill1:=o1;
  o1:=0;
  t1_2;
  try(time2, alltime);
  linus:=o;
  linus1:=o1;
  o1:=0;
  t2_3;
  try(time3, alltime);
  steve:=o;
  steve1:=o1;
  inc(i);
  if i<>text then ww(i);
  if (steve>bill) and (steve>linus) then print(1)
    else if (steve=bill) and (bill1>=steve1) then print(1)
      else if (steve=linus) and (steve1<=linus1) then print(1)
        else if (bill>linus) or ((bill=linus) and (bill1<=linus1))then print(2)
          else print(3);
end;
begin
  readln(text);
  while text <= 0 do begin
    writeln('ERROR');
    readln(text);
  end;
  ww(0);
  for i:=1 to 24 do
    if string1[i]<>'' then begin
      WriteLn('Senario #', i, ':');
      writeln(string1[i]);
    end;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator