比赛 20091102 评测结果 AWWWWWWAWA
题目名称 wordsa 最终得分 30
用户昵称 rottenwood 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-02 12:10:21
显示代码纯文本
program wordsa;
const
yue:array[1..12] of integer=(31,28,31,30,31,30,31,31,30,31,30,31);
var
s1,s2,s3:string;
s:array[1..5000] of longint;
fen,tol,i,j,k,m,n,day,n1,n2,y1,y2,r1,r2,h1,h2,f1,f2,f,code:longint;
procedure qsort(l,r:Integer);
var
  i,j,x,y:integer;
begin
  i:=l; j:=r; x:=s[(l+r) div 2];
  repeat
    while s[i]>x do i:=i+1;
    while x>s[j] do j:=j-1;
    if i<=j then
    begin
      y:=s[i]; s[i]:=s[j]; s[j]:=y;
      i:=i+1; j:=j-1;
    end;
  until i>j;
  if l<j then qsort(l,j);
  if i<r then qsort(i,r);
end;
begin
assign(input,'wordsa.in');reset(input);
assign(output,'wordsa.out');rewrite(output);
readln(n);
for i:=1 to n do
readln(s[i]);
readln(s1);
readln(s2);
qsort(1,n);
s3:=copy(s1,1,4);val(s3,n1,code);s3:=copy(s2,1,4);val(s3,n2,code);
s3:=copy(s1,6,2);val(s3,y1,code);s3:=copy(s2,6,2);val(s3,y2,code);
s3:=copy(s1,9,2);val(s3,r1,code);s3:=copy(s2,9,2);val(s3,r2,code);
s3:=copy(s1,13,2);val(s3,h1,code);s3:=copy(s2,13,2);val(s3,h2,code);
s3:=copy(s1,16,2);val(s3,f1,code);s3:=copy(s2,16,2);val(s3,f2,code);
if (n1<n2)or(y1<y2) then
 begin
  r1:=yue[y1]-r1+1;
  if (n1 mod 4=0)and(n1 mod 100<>0)and(y1=2) then inc(day);
  r1:=1;inc(y1);
  while (n1<n2)or(y1<y2) do
   begin
    day:=day+yue[y1];
    if (n1 mod 4=0)and(n1 mod 100<>0)and(y1=2) then inc(day);
    if y1<12 then inc(y1) else begin y1:=1;inc(n1);end;
   end;
 end;
 inc(day,r2-r1);
 fen:=day*24+(h2-h1)*60+f2-f1;
for i:=1 to n do
 begin
 if fen-s[i]>=0 then begin inc(tol);fen:=fen-s[i]; end;
 end;
writeln(tol);
end.