We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Project Euler #224: Almost right-angled triangles II

# Project Euler #224: Almost right-angled triangles II

Contest ends in

#### Sort by

recency

#### |

#### 20 Discussions

#### |

Please Login in order to post a comment

timeout and almost all in red. But the code seems ok?. Guess to make a more efficient code we need a third equation related with the angles (to eliminate some loop) but Im lazy.

am confused,i dont get the example pls provide the answers to a,b, and c for the example u gave "21". so far it got me only one 4,8 and 9 resectively

2 days of math and code, result: 25 :(

This code is Timed out for all the test cases except the test case 0.can any one explain me where i did wrong?

## include

## include

## include

## include

int main() { long long int n,q,a,b,c,d=0; scanf("%lld",&q); while(q--) { scanf("%lld",&n); for(a=1;a<=n;a++) { for(b=a;b<=n;b++) { for(c=a;c<=n;c++) { if( pow(a,2)+pow(b,2) == pow(c,2)-1 ) { if(a+b+c<=n) d++; //printf("%lld %lld %lld \n",a,b,c); } } } } printf("%lld\n",d); }

}

There is a timeout for all test cases except for test 0.