1 solutions

  • 1
    @ 2026-9-23 18:49:35
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
    	cin>>n;
    	int cnt=0;
    	for(int a=1;a<=n;a++)
    	{
    		for(int b=1;b<=n;b++)
    		{
    			for(int c=1;c<=n;c++)
    			{
    				if(a*a+b*b==c*c&&a<=b&&b<=c)
    				{
    					cnt++;
    				}
    			}
    		}
    	}
    	cout<<cnt;
    	return 0; 
    }
    

    Information

    ID
    1174
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    108
    Accepted
    39
    Uploaded By