怎么会是6种哦 我认为没错 我提醒一哈 你的int该改为float
题目是整数干嘛改成float?int就对的啊
----------------解决方案--------------------------------------------------------
......我也感觉是四种
[此贴子已经被作者于2007-5-9 20:13:02编辑过]
----------------解决方案--------------------------------------------------------
15 20 12
20 15 12
30 40 24
40 30 24
----------------解决方案--------------------------------------------------------
#include <stdio.h>
void main()
{
unsigned int A,B,C,count;
count=0;
for(A=3;A<=98;A++)
{
for(B=2;B<A;B++)
for(C=1;C<B;C++)
if((C<(100-A-B))&&(B*B*C*C+A*A*C*C==A*A*B*B) )
{
count++;
printf("%d,%d,%d\n",A,B,C);}
}
printf("count=%d\n",count);
}
运行结果:
20,15,12
40,30,24
60,45,36
80,60,48
count=4
----------------解决方案--------------------------------------------------------
题目是整数干嘛改成float?int就对的啊
#include <stdio.h>
void main()
{unsigned float A,B,C;
int count;
count=0;
for(A=1;A<=97;A++)
{ for(B=1;B<=97;B++)
for(C=1;C<=97;C++)
if(100>(A+B+C)&&(B*B*C*C+A*A*C*C==A*A*B*B))
{count++;printf("%f,%f,%f\n",A,B,C);}
}
printf("count=%d",count);}
你改为int试一哈
----------------解决方案--------------------------------------------------------
15 20 12
20 15 12
30 40 24
40 30 24
这个算2组吧
要确保A》B》C的
----------------解决方案--------------------------------------------------------
加起来大于100了
----------------解决方案--------------------------------------------------------
只有2组了啊。。。
----------------解决方案--------------------------------------------------------
#include <stdio.h>
void main()
{unsigned float A,B,C;
int count;
count=0;
for(A=1;A<=97;A++)
{ for(B=1;B<=97;B++)
for(C=1;C<=97;C++)
if(100>(A+B+C)&&(B*B*C*C+A*A*C*C==A*A*B*B))
{count++;printf("%f,%f,%f\n",A,B,C);}
}
printf("count=%d",count);}
你改为int试一哈
我的是int的可以啊
----------------解决方案--------------------------------------------------------
只有2组了啊。。。
还是红影强
呵呵
----------------解决方案--------------------------------------------------------