精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 一個(gè)自然數(shù)是素?cái)?shù),且它的數(shù)字位置經(jīng)過(guò)任意對(duì)換后仍為素?cái)?shù),則稱為絕對(duì)素?cái)?shù),例如13.

    一個(gè)自然數(shù)是素?cái)?shù),且它的數(shù)字位置經(jīng)過(guò)任意對(duì)換后仍為素?cái)?shù),則稱為絕對(duì)素?cái)?shù),例如13.
    請(qǐng)找出所有x位的絕對(duì)素?cái)?shù)的數(shù)量.
    輸入x(x<=5)
    輸入樣例:
    1
    輸出樣例:
    4
    其他人氣:763 ℃時(shí)間:2020-04-11 01:37:09
    優(yōu)質(zhì)解答
    var
    a,k,i,w,sum,x:longint;
    s:array[1..8363]of longint;
    e:array[1..8363]of boolean;
    st:string;
    b:array[1..5]of char;
    flag:array[0..9]of boolean;
    c:array[1..120]of string;
    procedure search(depth:integer);
    var i,t:integer;
    begin
    if(depth>a) then
    begin
    inc(x);
    for i:=1 to a do c[x]:=c[x]+b[i];
    exit;
    end;
    for i:=1 to a do
    if flag[i]=false then
    begin
    b[depth]:=st[i];
    flag[i]:=true;
    search(depth+1);
    flag[i]:=false;
    end;
    end;
    function erfen(o:string):boolean;
    var
    m,head,tail,j:longint;
    begin
    val(o,m);
    head:=1;
    tail:=w;
    j:=trunc((head+tail)/2);
    repeat
    if s[j]=m then exit(false)
    else
    if s[j]>m then
    begin tail:=j-1; j:=trunc((head+tail)/2) end
    else if s[j]begin head:=j+1; j:=trunc((head+tail)/2) end;
    until (head>tail);
    exit(true);
    end;
    procedure checks(w:longint);
    var
    i,j:longint;
    begin
    for i:=1 to w do
    begin
    str(s[i],st);
    x:=0;
    search(1);
    for j:=1 to k do
    if erfen(c[j]) then e[i]:=false;
    for j:=1 to k do
    c[j]:='';
    end;
    end;
    function check(w:longint):boolean;
    var
    i:longint;
    begin
    for i:=2 to round(sqrt(w)) do
    if w mod i =0 then exit(false);
    exit(true);
    end;
    procedure trys(a:longint);
    var
    i,j,head,tail:longint;
    begin
    tail:=9;
    head:=1;
    w:=0;
    for i:=1 to a-1 do
    begin
    head:=head*10;
    tail:=tail*10+9;
    end;
    for i:=head to tail do
    if check(i) then begin inc(w);s[w]:=i; end;
    checks(w);
    for i:=1 to w do
    if e[i] then inc(sum);
    write(sum);
    end;
    begin
    k:=1;
    fillchar(e,sizeof(e),true);
    readln(a);
    for i:=2 to a do
    k:=k*i;
    if a=1 then write(4)
    else if a<5 then trys(a)
    else if a=5 then write(0);
    end.
    我來(lái)回答
    類似推薦
    請(qǐng)使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁(yè)提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版