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 JiangLY at 2005-07-23 22:41:04 on Problem 2501
In Reply To:比赛的时候因为这个白re一次 Posted by:frkstyc at 2005-07-23 22:40:17
var
  c1,c2,c3:char;
  k,n,a,b,c,la,lb,lc,sa,sb,sc,s:extended;
  t:string;
begin
  s:=0;
  la:=0;
  lb:=0;
  lc:=0;
  while not seekeof do
    begin
      read(c1,c2,c3);
      t:=c1+c2+c3;
      a:=(ord(c1)-48)*10+ord(c2)-48;
      read(c1,c2,c3);
      t:=t+c1+c2+c3;
      b:=(ord(c1)-48)*10+ord(c2)-48;
      read(c1,c2);
      t:=t+c1+c2;
      c:=(ord(c1)-48)*10+ord(c2)-48;
      sa:=a;
      sb:=b;
      sc:=c;
      if la+lb+lc<>0 then
        begin
          n:=0;
          if c<lc then
            begin
              c:=c+60;
              b:=b-1;
              n:=n+c-lc;
            end
                  else n:=n+c-lc;
          if b<lb then
            begin
              b:=b+60;
              c:=c-1;
              n:=n+(b-lb)*60;
            end
                  else n:=n+(b-lb)*60;
          n:=n+(a-la)*3600;
          s:=s+n/3600*k;
        end;
      la:=sa;
      lb:=sb;
      lc:=sc;
      if not seekeoln then
        begin
          readln(k);
        end
                      else
        begin
          readln;
          writeln(t,' ',s:1:2,' km');
        end;
    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