/ SB域 /

记录详情

Accepted

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

代码

var n,e,m,ans,t,i:longint;
    f:boolean;
    a,u:array[1..10000]of boolean;
begin
 readln(n,e,m);
 fillchar(a,sizeof(a),true);
 for i:=1 to m do begin
  read(t);
  a[t]:=false;
 end;
 for ans:=1 to n do begin
  i:=1;
  f:=true;
  fillchar(u,sizeof(u),false);
  while i<>e do begin
   u[i]:=true;
   if i=n then i:=1
   else begin inc(i,ans);
    if i>n then i:=i-n
   end;
   if u[i] then begin f:=false; break end;
   if a[i]=false then begin f:=false; break; end;
  end;
  if f then begin writeln(ans);
  close(input);
  close(output);
  halt; end;
 end;
 writeln('-1');
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
桐桐的跳棋游戏
题目数据
下载
语言
Pascal
递交时间
2017-08-22 14:46:27
评测时间
2017-08-22 14:46:27
评测机
分数
100
总耗时
13ms
峰值内存
256.0 KiB