2009-04-25 07:10:53來源不明

畢氏的定理

暴力

/******************************************/

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
 int a,b,c=0;
 for(a=1;a<998&&c==0;a++)
  for(b=a;b<998;b++)
   {
    int temp=(int)sqrt(a*a+b*b);
    if(temp*temp==a*a+b*b&&a+b+temp==1000)
     {printf("%d\n",a*b*temp);c=1;break;}
   }
 system("pause");
}