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

不规范答案。改改就好

Posted by Muse_Gdut at 2004-10-13 18:31:15 on Problem 1857
program wxy;
var
  max,len,n:integer;
  box,speed:array[1..100] of integer;
  book:array[0..1000] of real;
  procedure init;
  var
    a:integer;
    f:text;
  begin
    assign(f,'bridge.in');
    reset(f);
    readln(f,max,len,n);
    for a:=1 to n do readln(f,box[a],speed[a]);
    close(f);
  end;
  procedure main;
  var
    a,s,total,slow:longint;
  begin
    fillchar(book,sizeof(book),0);
    book[1]:=len/speed[1];
    for a:=2 to n do
      begin
        total:=0;
        s:=a;
        slow:=speed[a];
        while s>=1 do
          begin
            inc(total,box[s]);
            if total>max then break;
            if slow>speed[s] then slow:=speed[s];
            if (book[a]=0) or (book[a]>book[s-1]+len/slow) then book[a]:=book[s-1]+len/slow;
            dec(s);
          end;
      end;
  end;
  procedure out;
  var
    f:text;
  begin
    assign(f,'bridge.out');
    rewrite(f);
    write(f,book[n]*60:0:1);
    close(f);
  end;
begin
  init;
  main;
  out;
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