PersonalCorpus 版 (精华区)

156904 14:26:20 7 Mar 2002
Bozhang,HIT,P.R.China 1086 Pascal Accepted 0.14 sec 106K


var
    p:array[1..15000] of integer;
    i,j,k:integer;
    f:boolean;
begin
    p[1]:=2; k:=1;
    for i:=3 to 163841 do begin
        f:=true;
        for j:=1 to k do begin
            if p[j]*p[j]>i then break;
            if i mod p[j]=0 then begin f:=false; break end;
        end;
        if f then begin
            inc(k);
            p[k]:=i;
        end;
    end;
    readln(k);
    for i:=1 to k do begin
        readln(j);
        writeln(p[j]);
    end;
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.715毫秒