过4个点,3个TLE,萌新求指教

P1865 A % B Problem

加缩进之后 ```cpp var i,n,k,m:longint; l,r:array[0..1000005]of longint; procedure zhi(s,f:longint); var j:longint; begin m:=0; for j:=s to f do if j>7 then if (j mod 2=0) or (j mod 3=0) or (j mod 5=0) or (j mod 7=0) then continue else inc(m) else if (j=2) or(j=3) or(j=5) or(j=7) then inc(m) else continue; end; begin read(n,k); for i:=1 to n do read(l[i],r[i]); for i:=1 to n do if (r[i]>=1) and (r[i]<=k) and (l[i]>=1) and (l[i]<=k) then begin zhi(l[i],r[i]); writeln(m); end else writeln('Crossing the line'); end. ```
by guostnm @ 2017-10-27 23:32:37


|