- 八
- 2009-08-25 21:36:02 @
var
c:array[1..5] of longint;
n,i,a,b,t:longint;
function try(x:longint):boolean;
var
i:longint;
begin
try:=false;
if x mod 8 0 then exit;
for i:=1 to n do
if x mod c[i] =0
then exit;
try:=true;
end;
begin
readln(n);
for i:=1 to n do
read(c[i]);
readln;
readln(a,b);t:=0;
for i:=a to b do
if try(i)
then inc(t);
writeln(t);
end.
后七个点超时拉....
Why!!!!!!!!!!!!!!!!!!!!!!!!!
1 条评论
-
SDreaming LV 10 @ 2009-08-25 21:45:06
= =
显然。
首先你c数组开太小了。
然后你的时间复杂度是O(10^9*15)
WA掉是正常的。你应该还是初中吧。建议你去看看容斥原理或看看题解再来做这道题
- 1