比赛 |
20101118 |
评测结果 |
AAAAAAAAET |
题目名称 |
八 |
最终得分 |
80 |
用户昵称 |
Des. |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-18 09:46:56 |
显示代码纯文本
program eight;
var a:array[1..100000000]of boolean;
t,k,m,n,i,j,p,s,an:longint;
b:array[1..15]of longint;
function min(a,b:longint):longint;
begin
if a>b then min:=b else min:=a;
end;
function max(a,b:longint):longint;
begin
if a>b then max:=a else max:=b;
end;
function gcd(a,b:longint):longint;
var t,k,i:longint;
begin
t:=max(a,b);
k:=min(a,b);
if k=0 then exit(t);
i:=gcd(k, t mod k);
gcd:=i;
end;
begin
assign(input,'eight.in');
reset(input);
assign(output,'eight.out');
rewrite(output);
readln(n);
for t:=1 to n do
begin
read(b[t]);
if (b[t]=1)or(b[t]=2)or(b[t]=4) then
begin
writeln(0);
close(output);
halt;
end;
end;
readln;
readln(i,j);
if (i mod 8=0)and(j mod 8=0) then
begin
m:=(i div 8)-1;
k:=(j div 8)+1-m;
end
else if (i mod 8=0)and(j mod 8<>0) then
begin
m:=(i div 8)-1;
k:=j div 8-m;
end
else
begin
m:=(i div 8);
k:=j div 8-m;
end;
for t:=1 to n do
begin
s:=b[t]*8 div gcd(b[t],8);
for p:=i div s to j div s do
a[(s*p div 8)-m]:=true;
end;
for t:=1 to k do
if a[t]=false then
inc(an);
writeln(an);
close(output);
end.