pascal编程求正整数A和B之间的完全数
来源:百度知道 编辑:UC知道 时间:2024/06/22 00:56:33
program l_1(input,output);
type
cc=record
data,total:integer;
end;
var
a,b,i,he:integer;
bt:array[1..1000] of cc;
function fac(a:integer):integer;
var
i:integer;
begin
fac:=0;
for i:=1 to a-1 do
if a mod i=0 then fac:=fac+i;
end;
begin
he:=0;
assign(input,'work1_3.in');
reset(input);
assign(output,'work1_3.out');
rewrite(output);
readln(a,b);
for i:=a to b do
begin
bt[i-a+1].data:=i;
bt[i-a+1].total:=fac(i);
if fac(i)=i then inc(he);
end;
writeln(he);
for i:=1 to b-a+1 do
if bt[i].data=bt[i].total then writeln(bt[i].data);
close(input);
close(output);
end.
都是枚举
若比n小的正因数之和等于n,则n称为完全数
pascal编程求正整数A和B之间的完全数
已知A<B,A和B均是正整数,且A*B=2698,求A+B的最小值
C编程:已知AB为正整数,A<B,A*B=716699要求A+B取最小值,求满足条件的A值.
已知a,b为正整数,且ab+a+b=14.求a和b的值
a,b为正整数,且56a+392b为完全平方数,求a+b的最小值。我要知道为什么
三个不同的正整数a,b,c,使a b c=133,且任意两个数的和都是完全平方数,则a,b,c是 .
a*a+2002*a是完全平方数,求a的最大正整数的值?
设根号(27-10*根号2)=A+B,其中A为正整数,B在0,1之间,求 (A+B)/(A-B)
已知 根号a+根号b=根号333 ;求a,b的正整数解。
用pascal计算a+b的和!急!急!