4 solutions

  • 1
    @ 2026-2-26 11:11:01
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            int a;
            cin>>a;
            int s=0;
            for(int x=1;x*x<=a;x++)
            {
                for(int y=1;y*y<=a;y++)
                {
                    if(x*x+y*y==a)
                    {
                        s=1;
                    }
                   
                }
            }
            if(s==1)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
        }
        return 0;
    } 
    

    Information

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