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 |
我的……过……过不了……帮忙……var total:real; k,n:integer; a,b:array [1..1000] of real; c,d:array [1..1000] of integer; procedure init; begin repeat inc(n); read(b[n]); until b[n]=0; dec(n); a:=b; end; procedure print; var i,j:integer; begin for i:=1 to n do for j:=1 to n do if b[i]=a[j] then d[i]:=c[j]; for i:=1 to n do writeln(d[i]-1,' card(s)'); end; procedure work; var temp:real; i,j:integer; begin for i:=1 to n do for j:=i+1 to n do if a[i]>a[j] then begin temp:=a[i]; a[i]:=a[j]; a[j]:=temp; end; k:=1; for i:=2 to 500 do begin total:=total+1/i; if total>a[k] then begin inc(k); c[k-1]:=i; end; if k>n then exit; end; end; begin init; work; print; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator