比赛 20101118 评测结果 AAATTTTTTT
题目名称 最终得分 30
用户昵称 ZhouZn1 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-18 10:46:51
显示代码纯文本
program zzn;
var
        ans,l,r,fac,n,i,j,a,b:longint;
        nn:array[1..15]of longint;
procedure init;
begin
        assign(input,'eight.in');
        reset(input);
        assign(output,'eight.out');
        rewrite(output);
        readln(n);
        for i:=1 to n do read(nn[i]);
        readln(a,b);
end;
procedure closef;
begin
        close(input);
        close(output);
end;
function can(x:longint):boolean;
var
        i:integer;
begin
        for i:=1 to n do if x mod nn[i]=0 then exit(false);
        if x mod 8<>0 then exit(false);
        exit(true);
end;
procedure main;
begin
        ans:=0;
        for i:=a to b do
        begin
            if can(i) then
             inc(ans);
        end;
        writeln(ans);
end;
function can2(x:longint):boolean;
var
        i:longint;
begin
        for i:=1 to n do if x mod nn[i]=0 then exit(false);
        exit(true);
end;
procedure main2;
var
        l,r,i:longint;
begin
        l:=a div 8;
        if l*8<a then inc(l);
        r:=b div 8;
        ans:=0;
        for i:=l to r do
        begin
            fac:=8*i;
            if can2(fac) then
             inc(ans);
        end;
        writeln(ans);
end;
begin
        init;
        if b<=100000  then main else
        main2;
        closef;
end.