PersonalCorpus 版 (精华区)

15739 2002-11-10 15:15:14 BigGuava
113 .PAS Accepted 62 ms 44 kb

var
    p:array[1..32000] of boolean;
    i,j,k,l,n,m:integer;
    ok,ok2:boolean;
begin
    fillchar(p,sizeof(p),1); p[1]:=false;
    for i:=2 to 32000 do if p[i] then begin
        j:=i+i;
        while j<=32000 do begin
            p[j]:=false;
            inc(j,i);
        end;
    end;

    read(n);
    for i:=1 to n do begin
        read(m); ok:=false;
        for j:=2 to trunc(sqrt(m))+1 do if p[j] then
            if m mod j=0 then begin
                k:=m div j; ok2:=true;
                if k<=32000 then begin
                    if p[k] then ok:=true;
                    break;
                end;
                for l:=2 to trunc(sqrt(k))+1 do if p[l] then
                if k mod l=0 then begin
                    ok2:=false;
                    break;
                end;
                if ok2 then begin
                    ok:=true;
                    break;
                end;
            end;
        if ok then writeln('Yes') else writeln('No');
    end;
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.892毫秒