边长在1000以内,找三个三角形,两个三角形的周长和面积分别相等 看看能招多少对
三角形的总数量有多少?这个不明确,无法解答。不同量级的,算法完全不同。
另:边长的数据类型,int,float,double,算法又有不同,浮点数需明确误差精度
int main()
{
int length_A,length_B,length_C,count;
count=0;
for (length_A=1,length_A<1000,length_A++)
{
for (length_B=1,length_B<1000,length_B++)
{
length_C=1000-length_A-length_B;
if((length_A+length_B)>length_C&&(length_A+length_C)>length_B&&(length_B+length_C)>length_A)
{
count++;
printf("%d,length_A=%d,length_B=%d,length_C=%d\n",count,length_A,length_B,length_C);
}
}
}
}