📄 ac1057.pas
字号:
program tju1057;
const
mintime=480;
maxtime=1260;
var
count:array[mintime-1..maxtime]of byte;
n,t,i,j,p,x,y:word;
s:string;
no:boolean;
procedure time2num(s:string;var x:word);
var
p,h,m:byte;
begin
p:=1;
h:=0;repeat h:=h*10+ord(s[p])-48;inc(p);until s[p]=':';inc(p);
m:=0;repeat m:=m*10+ord(s[p])-48;inc(p);until s[p]>'9';
x:=(h mod 12+ord(s[p]='p')*12)*60+m;
end;
procedure out(x:word);
var
h,m:byte;
s:string[2];
begin
h:=x div 60;m:=x mod 60;
if h<12 then s:='am' else s:='pm';
h:=h mod 12;if h=0 then h:=12;
if h<10 then write('0');write(h,':');if m<10 then write('0');write(m,s);
no:=false;
end;
begin
repeat
fillchar(count,sizeof(count),0);
readln(n);
for i:=1 to n do begin
readln(t);
for j:=1 to t do begin
readln(s);
p:=pos('-',s);
time2num(copy(s,1,p-1),x);
time2num(copy(s,p+1,length(s)-p),y);
for p:=x to y-1 do
inc(count[p]);
end;
end;
no:=true;
for i:=mintime to maxtime do
if (count[i]=n) and (count[i-1]<n) then begin
out(i);write('-');
end
else if (count[i]<n) and (count[i-1]=n) then begin
out(i);writeln;
end;
if no then writeln('No');
until seekeof;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -