1到33之间任意6个数相加等于75的组合有多少(数和数不要重复的),如果能把算法和结果附上,我感恩不尽.

来源:百度知道 编辑:UC知道 时间:2024/05/26 12:16:08

9663种
电脑算的
Program abcdefg;
Var
i,j,k,l,m,n:Integer;
a:Longint;
Begin
a:=0;
For i:=1 to 33 do
For j:=i+1 to 33 do
For k:=j+1 to 33 do
For l:=k+1 to 33 do
For m:=l+1 to 33 do
For n:=m+1 to 33 do
Begin
If (i+j+k+l+m+n)=75 Then
Begin
Writeln(i,'+',j,'+',k,'+',l,'+',m,'+',n,'=75');
a:=a+1
End
Else If (i+j+k+l+m+n)>75 Then n:=33;
End;
Writeln(a);
Readln();
End.

69192种,编程算的
int x1, x2, x3, x4, x5, x6,i=0;
for (x1 = 1; x1 <= 33; x1++)
for (x2 = x1+1; x2 <= 33; x2++)
for (x3 =x2+1; x3 <= 33; x3++)
for (x4 = x3+1; x4 <= 33; x4++)
for (x5 = x4+1; x5 <= 33; x5++)
{
x6 = 75 - x1 - x2 - x3 - x4 - x5;
if (x6 >