Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我的程序没错吧...program fddasf; var f:text; i,j,k,n,s:integer; t:integer; a:array [1..1000,0..3] of real; c:array [1..100] of boolean; time,timea,timeb:real; d:array [1..100,1..2] of integer; procedure run; begin end; procedure readfile; begin assign(f,'ACM1310.IN'); reset(f); readln(n); t:=0; while (n<>-1) do begin t:=t+1; fillchar(a,sizeof(a),0); fillchar(d,sizeof(d),0); for i:=1 to n do begin readln(a[i,0],a[i,1],a[i,2],a[i,3]); end; fillchar(c,sizeof(c),false); for i:=30 to 60 do begin c[i]:=true; for j:=1 to n do begin time:=a[j,0]/i*3600; timea:=time/(a[j,1]+a[j,2]+a[j,3]); timeb:=(a[j,1]+a[j,2])/(a[j,1]+a[j,2]+a[j,3]); if (timea-int(timea))>timeb then c[i]:=false; end; end; write('Case ',t,': ' ); i:=29; k:=0; repeat i:=i+1; if ((c[i]) and (not (c[i+1]))) then begin k:=k+1; d[k,1]:=i; d[k,2]:=i; end else if c[i] then begin j:=i; while (c[i+1]) do begin i:=i+1; end; k:=k+1; d[k,1]:=j; d[k,2]:=i; end; until i=60; if (k>=1) then begin for i:=1 to k-1 do begin if (d[i,1]=d[i,2]) then write(d[i,1],', ') else write(d[i,1],'-',d[i,2],', '); end; if (d[k,1]=d[k,2]) then write(d[k,1]) else write(d[k,1],'-',d[k,2]); end else write('No acceptable speeds.'); readln(n); if n<>-1 then writeln; end; end; begin readfile; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator