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

1316为什么这也会错?想不通呀

Posted by orange at 2003-09-08 18:27:40 on Problem 1316
var f:array[1..10000] of boolean;

function next(x:integer):integer;
var temp:integer;
begin
  temp:=x;
  while x>0 do begin
    temp:=temp+x mod 10;
    x:=x div 10;
  end;
  next:=temp;
end;

procedure work;
var i,j:integer;
begin
  fillchar(f,sizeof(f),true);
  for i:=1 to 9999 do begin
    j:=next(i);
    if j<10000 then f[j]:=false;
  end;
  for i:=1 to 9999 do
    if f[i] then begin
      writeln(i);
      readln;
    end;
end;

begin
  work;
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