比赛 20091102 评测结果 AWWWWWWAWW
题目名称 wordsa 最终得分 20
用户昵称 打不死的羊 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-11-02 12:12:48
显示代码纯文本
program wordsa;
const
yue:array[1..12]of longint=(31,28,31,30,31,30,31,31,30,31,30,31);
type
fxz=array[1..5000] of longint;

var
f1,f2:text;
h1,h2,i,j,k,n,fen1,fen2,m1,m2,y1,y2,d1,d2,c,day,fen,ans:longint;
st:string;
a:fxz;

procedure qsort(left,right:longint);
  var
   l,r,x,y:longint;
  begin
   l:=left; r:=right; x:=a[(l+r) div 2];
   repeat
    while a[l]<x do inc(l);
    while a[r]>x do dec(r);
    if l<=r then
     begin
      y:=a[l];
      a[l]:=a[r];
      a[r]:=y;
      inc(l); dec(r);
     end;
   until l>r;
   if l<right then qsort(l,right);
   if r>left then qsort(left,r);
  end;


begin assign(f1,'wordsa.in');
      assign(f2,'wordsa.out');
      reset(f1);rewrite(f2);
      readln(f1,n);
      for i:=1 to n do
      readln(f1,a[i]);
      qsort(1,n);
readln(f1,st);
 val(copy(st,1,(pos('-',st)-1)),y1,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos('-',st)-1)),m1,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos('-',st)-1)),d1,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos(':',st)-1)),h1,c);
 delete(st,1,pos(':',st));
 val(st,fen1,c);

 readln(f1,st);
 val(copy(st,1,(pos('-',st)-1)),y2,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos('-',st)-1)),m2,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos('-',st)-1)),d2,c);
 delete(st,1,pos('-',st));
 val(copy(st,1,(pos(':',st)-1)),h2,c);
 delete(st,1,pos(':',st));
 val(st,fen2,c);




      if (y1<y2)or(m1<m2) then
      begin
      day:=yue[m1]-d1+1;
      if (y1 mod 4=0)and(y1 mod 100<>0)and(m1=2) then inc(day);
      d1:=1;inc(m1);
      while (y1<y2)or(m1<m2) do
       begin
       day:=day+yue[m1];
       if (y1 mod 4=0)and(y1 mod 100<>0)and(m1=2) then inc(day);
       if m1<12 then inc(m1) else begin m1:=1;inc(y1);end;
       end;
      end;
 inc(day,d2-d1);
 fen:=day*24+(h2-h1)*60+fen2-fen1;
ans:=0;i:=1;
repeat fen:=fen-a[i];
       if fen>=0 then inc(ans);
       inc(i);
until fen<=0;
writeln(f2,ans);
close(f1);close(f2);
end.