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-05-07 15:36:59 on Problem 1215
我都按每分钟来模拟了还WA,55555~~~~~
const
  dayset:set of 0..23=[8,9,10,11,12,13,14,15,16,17];
  eveningset:set of 0..23=[18,19,20,21];
  nightset:set of 0..23=[22,23,0,1,2,3,4,5,6,7];
var
  s,num:string;
  t:char;
  i,j,k1,k2,l,a,b,c,d,code,p,evening,day,night:longint;
  pay:real;
  map:array['A'..'E',1..3] of real;
begin
  map['A',1]:=0.1;
  map['A',2]:=0.06;
  map['A',3]:=0.02;
  map['B',1]:=0.25;
  map['B',2]:=0.15;
  map['B',3]:=0.05;
  map['C',1]:=0.53;
  map['C',2]:=0.33;
  map['C',3]:=0.13;
  map['D',1]:=0.87;
  map['D',2]:=0.47;
  map['D',3]:=0.17;
  map['E',1]:=1.44;
  map['E',2]:=0.80;
  map['E',3]:=0.30;
  readln(s);
  while s<>'#' do
    begin
      s:=s+' ';
      t:=s[1];
      delete(s,1,1);
      while s[1]=' ' do delete(s,1,1);
      p:=pos(' ',s);
      num:=copy(s,1,p-1);
      delete(s,1,p);
      while s[1]=' ' do delete(s,1,1);
      p:=pos(' ',s);
      val(copy(s,1,p-1),a,code);
      delete(s,1,p);
      while s[1]=' ' do delete(s,1,1);
      p:=pos(' ',s);
      val(copy(s,1,p-1),b,code);
      delete(s,1,p);
      while s[1]=' ' do delete(s,1,1);
      p:=pos(' ',s);
      val(copy(s,1,p-1),c,code);
      delete(s,1,p);
      while s[1]=' ' do delete(s,1,1);
      p:=pos(' ',s);
      val(copy(s,1,p-1),d,code);
      if (a=c)and(b=d) then
        begin
          writeln('  ',num,10:6,4:6,10:6,' ',t,' ',(map[t,1]*600+map[t,2]*240+map[t,3]*600):7:2);
          readln(s);
          continue;
        end;
      evening:=0;
      day:=0;
      night:=0;
      k1:=a;
      k2:=b;
      while (k1<>c)or(k2<>d) do
        begin
          inc(k2);
          if k1 in dayset then inc(day)
          else if k1 in nightset then inc(night)
          else inc(evening);
          if k2=60 then
            begin
              k2:=0;
              k1:=(k1+1) mod 24;
            end;
        end;
      pay:=map[t,1]*day+map[t,2]*evening+map[t,3]*night;
      writeln('  ',num,day:6,evening:6,night:6,' ',t,' ',pay:7:2);
      readln(s);
    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