比赛 |
20091102 |
评测结果 |
WTTTTTTTTA |
题目名称 |
wordsa |
最终得分 |
10 |
用户昵称 |
lc |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-11-02 12:13:33 |
显示代码纯文本
program wordsa;
const
maxn = 5000;
var
n: longint;
ans: longint;
time: longint;
s: string;
minu: array[1..maxn] of longint;
a,b: array[1..5] of longint;
procedure qsort(l,r:longint);
var
i,j,x,temp: longint;
begin
i :=l; j :=r; x :=minu[(i+j) shr 1];
repeat
while minu[i] <x do inc(i);
while minu[j] >x do dec(j);
if i <=j then begin
temp :=minu[i]; minu[i] :=minu[j]; minu[j] :=temp;
inc(i); dec(j);
end;
until i >j;
if j >l then qsort(l,j);
if i <r then qsort(i,r);
end;
procedure init;
var
i: longint;
begin
readln(n);
for i :=1 to n do readln(minu[i]);
qsort(1,n);
end;
function Get(l,r:longint):longint;
var
num,i: longint;
begin
num :=0;
for i :=l to r do num :=num*10+ord(s[i])-48;
exit(num);
end;
procedure release(var year,month,day,hour,minute:longint);
begin
year :=Get(1,4);
month :=Get(6,7);
day :=Get(9,10);
hour :=Get(13,14);
minute :=Get(16,17);
end;
function day(y,m:longint):longint;
var
t: longint;
begin
case m of
1: t :=31;
2: if (y mod 100 = 0) and (y mod 400 = 0)
or (y mod 100 <>0) and (y mod 4 = 0)
then m :=29 else m :=28;
3: t :=31;
4: t :=30;
5: t :=31;
6: t :=30;
7: t :=31;
8: t :=31;
9: t :=30;
10:t :=31;
11:t :=30;
12:t :=31;
end;
exit(t);
end;
procedure main;
var
i: longint;
begin
readln(s);
release(a[5],a[4],a[3],a[2],a[1]);
readln(s);
release(b[5],b[4],b[3],b[2],b[1]);
if b[5] - a[5] >100 then writeln(n)
else begin
while true do begin
inc(a[1]);
if a[1] >59 then begin inc(a[2]); a[1] :=0; end;
if a[2] >23 then begin inc(a[3]); a[2] :=0; end;
if a[3] >day(a[5],a[4]) then begin inc(a[4]); a[3] :=1; end;
if a[4] >12 then begin inc(a[5]); a[4] :=1; end;
inc(time);
if (a[5] = b[5]) and (a[4] = b[4]) and (a[3] = b[3])
and (a[2] = b[2]) and (a[1] = b[1]) then break;
end;
for i :=1 to n do begin
if time <minu[i] then break;
inc(ans); dec(time,minu[i]);
end;
writeln(ans);
end;
end;
begin
assign(input,'wordsa.in'); reset(input);
assign(output,'wordsa.out'); rewrite(output);
init;
main;
close(input); close(output);
end.