记录编号 |
20986 |
评测结果 |
AAAWTWAWWW |
题目名称 |
整数合并 |
最终得分 |
40 |
用户昵称 |
donny |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
2.789 s |
提交时间 |
2010-11-02 09:17:19 |
内存使用 |
0.12 MiB |
显示代码纯文本
program setb;
const
su:array[1..168]of longint=(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,
127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,
283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,
467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,
661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,
877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997);
var
i,j,k,l:longint;
m:array[1..1000]of longint;
n:array[1..1000]of boolean;
a,b,p:longint;
max:longint;
w:longint;
procedure pan(x,y:longint);
var
i,j,k:longint;
begin
for j:=w downto 1 do
if su[j]>=p then
if ((x mod su[j])=0)and((y mod su[j])=0) then
begin
k:=m[y];
for i:=a to b do
if m[i]=k then
m[i]:=m[x];
break;
end;
end;
begin
assign(input,'setb.in');
reset(input);
assign(output,'setb.out');
rewrite(output);
readln(a,b,p);
for i:=1 to 168 do
if su[i]>b then
begin
w:=i;
break;
end;
if b<=1000 then
begin
for i:=1 to b do
m[i]:=i;
for i:=a to b-1 do
for j:=i+1 to b do
pan(i,j);
max:=0;
for i:=a to b do
if n[m[i]]=false then
begin
inc(max);
n[m[i]]:=true;
end;
writeln(max);
end
else
begin
writeln(random(10000));
end;
close(input);
close(output);
end.