/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 2ms 256.0 KiB
#2 Accepted 2ms 256.0 KiB
#3 Accepted 2ms 256.0 KiB
#4 Accepted 1ms 180.0 KiB
#5 Accepted 2ms 256.0 KiB
#6 Accepted 2ms 256.0 KiB
#7 Accepted 1ms 256.0 KiB
#8 Accepted 2ms 256.0 KiB
#9 Accepted 24ms 448.0 KiB
#10 Accepted 23ms 532.0 KiB
#11 Accepted 22ms 656.0 KiB
#12 Accepted 23ms 344.0 KiB
#13 Accepted 19ms 396.0 KiB
#14 Accepted 19ms 464.0 KiB
#15 Accepted 50ms 912.0 KiB
#16 Accepted 51ms 1.055 MiB
#17 Accepted 48ms 1.258 MiB
#18 Accepted 46ms 988.0 KiB
#19 Accepted 46ms 976.0 KiB
#20 Accepted 45ms 896.0 KiB

代码

var n,q,i:longint;
    a:array[0..100000]of int64;
    d,t:int64;
function gcd(a,b:int64):int64;
begin
 if a<0 then a:=-a;
 if b<0 then b:=-b;
 if b=0 then exit(a)
   else exit(gcd(b,a mod b));
end;
begin
 readln(n,q);
 d:=0;
 for i:=1 to n do begin
  read(a[i]);
  if i<>1 then d:=gcd(a[i]-a[i-1],d);
 end;
 for i:=1 to q do begin
  read(t);
  a[1]:=a[1]+t;
  writeln(gcd(a[1],d));
 end;
 close(input);
 close(output);
end.

信息

递交者
类型
递交
题目
最大公约数 NOI2012
题目数据
下载
语言
Pascal
递交时间
2017-08-22 16:39:08
评测时间
2017-08-22 16:39:08
评测机
分数
100
总耗时
438ms
峰值内存
1.258 MiB