70分求助WA
查看原帖
70分求助WA
1295820
ClV_Csy楼主2024/7/11 12:31
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int p;
		cin>>p;
		bool flag=0;
		for (int x=1;x<=p;x++)
		{
			if (p<x*x)
				continue;
			double y=sqrt(p-x*x);
			if (y&&y==int(y))
			{
				flag=1;
				break;
			}
		}
		if (flag)
			cout<<"Yes";
		else
			cout<<"No";
		cout<<endl;
	}
	return 0;
}
2024/7/11 12:31
加载中...