Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我的……过……过不了……帮忙……

Posted by 25278RQ at 2004-05-10 19:21:16 on Problem 1003
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator