a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 23:11:24
a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )
xRn@V<ĤfOP~{KōdUUJ B-VR$*BH |iV1,`e{Ϝs#[M‡7W/37ݠwFlaG4 ] S1Zkֿu^/zA zQ >7 MVՊ 2,CU5j;eY o[A'?^S:c%`Hجwmމ+N O:6|Nk^>sɎXDIlr2q*vK.]3wG @3 SϷjSu9cP\z7H Tڮh9axJIqaG\~\Ӹ[^IC2@|U6)1FEdgkI3|~ [ 6X@)8\_q"s_9cxykow-St&O-: TjpZLRy+KI[Z^s'"C4-š'Y뷙fM

a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )
a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )

a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=( )
ABC都是素数,并且A+B=33,B+C=44,C+D=66,那么D=
a=2
b=31
c=13
d=53

a=2
b=31
c=13
d=53 因为a+b得33,奇加偶得奇,所以a=2 b=31c与d可以推出来

//要求:
//a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=(?)
// 符合要求的只有一组 2 31 13 53
#include
#include
int fun(int n)
{
int i = 2;
for(; n % i; i++)...

全部展开

//要求:
//a,b,c都是素数,并且,a+b=33,b+c=44,c+d=66,d=(?)
// 符合要求的只有一组 2 31 13 53
#include
#include
int fun(int n)
{
int i = 2;
for(; n % i; i++);
if(i == n)
return 1;
return 0;
}
int main()
{
int a, b, c;
for(a = 2; a < 33; a++)
for(b = 2; b < 33; b++)
for(c = 2; c < 44; c++)
{
if(fun(a) && fun(b) && fun(c))
if((a + b) == 33 && (b + c) == 44)
printf("%5d%5d%5d%5d\n", a, b, c, 66 - c);
}
}

收起