5 solutions

  • 1
    @ 2026-8-14 15:09:55
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
    	cin>>n;
    	while(n--)
    	{
    		int a;
    		cin>>a;
            int cnt=0;
    		for(int x=1;x*x<=a;x++)
    		{
    			for(int y=1;y*y<=a;y++)
    			{
    				if(x*x+y*y==a)
    				{
    					cnt++;
    				}
    			}
    		}
    		if(cnt>0)
    		{
    			cout<<"Yes"<<endl;
    		}
    		else
    		{
    			cout<<"No"<<endl;
    		}
    	}
    	return 0; 
    }
    

    Information

    ID
    2179
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    # Submissions
    175
    Accepted
    47
    Uploaded By