2 solutions

  • 1
    @ 2025-6-8 10:19:37
    #include<bits/stdc++.h>
    using namespace std;
    int a[1111111];
    int main()
    {
        int T;cin>>T;
        while(T--)
        {
            int n,cnt=0;cin>>n;
            for(int i=1;i<=n/i;i++)
            {
                for(int j=1;j<=n/j;j++)
                {
                    if(i*i+j*j==n)
                    {
                        cnt++;
                    }
                }
            }
            if(cnt==0) cout<<"No"<<endl;
            else cout<<"Yes"<<endl;
        }
        return 0;
    }
    

    Information

    ID
    2179
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    17
    Accepted
    5
    Uploaded By