平方数

#include <stdio.h>
int main()
{
    int n, i, t, a, b, j, x, sum;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        sum=0;
        scanf("%d %d",&a, &b);
        if(a>b)
        {
            x=a;
            a=b;
            b=x;
        }
        for(t=a;t<=b;t++)
        {
            for(j=1;j<=t;j++)
            {
                if(j*j==t)
                {
                    sum=sum+t;
                }
            }
        }printf("%d\n",sum);
    }
    return 0;
}


相关文章:

  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-12-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-07-21
  • 2021-12-09
相关资源
相似解决方案