赛文奥特曼2002ova剧情:会c语言的请进来

来源:百度文库 编辑:高考问答 时间:2024/04/29 07:09:54
其平方等于某两个正整数平方之和的正整数称为弦数。例如,由于:9+16=25, 因此5为弦数。求[121,930]之间:弦数的数目,最小弦数,最大弦数。

因为(121,930)<(11*11,31*31)
#include "stdio.h"
#include "math.h"
void main()
{
int i,j,count=0,min=930,max=0;
float temp;
for(i=11;i<=(11+31)/2;i++)
{
for(j=i;j<=31;j++)
{
temp=sqrt(i*i+j*j);
if(int(temp)==temp && (temp<=930 && temp>=121))
{
count++;
if(temp>max)max=temp;
if(temp<min)min=temp;
}
}
}
printf("Count=%d Min=%d Max=%d",count,min,max);
}

有点麻烦 我试试

本来要答的,被人抢了,呵呵