/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 172ms 256.0 KiB
#2 Accepted 433ms 256.0 KiB
#3 Accepted 603ms 256.0 KiB
#4 Accepted 651ms 256.0 KiB
#5 Accepted 667ms 256.0 KiB
#6 Accepted 2ms 256.0 KiB
#7 Accepted 1ms 256.0 KiB
#8 Accepted 1ms 256.0 KiB
#9 Accepted 693ms 256.0 KiB
#10 Accepted 737ms 256.0 KiB

代码

var n,i,zhi,he:longint;
    a:qword;
    f:boolean;
function pow(x,n,k:qword):qword overload;
begin
 if n=0 then exit(1);
 pow:=pow(x,n div 2,k) mod k;
 pow:=pow*pow mod k;
 if n mod 2=1 then pow:=pow*x mod k;
end;
function ff(n:longint):boolean overload;
var m:qword;
      i:longint;
begin
  randomize;
  for i:=1 to 200 do begin
    m:=random(n-2)+1;
    if pow(m,n-1,n)<>1 then exit(False);
  end;
  exit(True);
end;
begin
{assign(output,'aa.txt');
rewrite(output);  }

 readln(n);
 for i:=1 to n do begin
  readln(a);
  if (a=0)or(a=1)then begin
   inc(he);
   writeln('FALSE');
   continue;
  end;
  f:=ff(a);
  if f then inc(zhi) else inc(he);
  writeln(f);
 end;
  writeln(zhi,' ',he);
{close(output);     }
end.

信息

递交者
类型
递交
题目
质数问题
题目数据
下载
语言
Pascal
递交时间
2017-08-22 13:58:57
评测时间
2017-08-22 13:58:57
评测机
分数
100
总耗时
3965ms
峰值内存
256.0 KiB