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 #223: Almost right-angled triangles I
Project Euler #223: Almost right-angled triangles I
Sort by
recency
|
24 Discussions
|
Please Login in order to post a comment
Can you explain me why this is not getting result against the testcases. Sample one Ok. but others not
//What is wrong in my code ????
include
include
include
include
include
include
include
using namespace std;
int main() { int i=0,j=0; int a,b,c,q,n; int tcount=0; cin>>q; for (i=0;i cin >>n; for (i=1;i for(j=i;j auto t=pow(i*i+j*j-1,0.5); if (typeid(t).name()==typeid(int).name()) if (t>=j && i+j+t<=n) tcount++;
} } } } cout<
What is wrong in my code ?????
include
include
include
include
include
include
include
using namespace std;
int main() { int i=0,j=0; int a,b,c,q,n; int tcount=0; cin>>q; for (i=0;i cin >>n; for (i=1;i for(j=i;j auto t=pow(i*i+j*j-1,0.5); if (typeid(t).name()==typeid(int).name()) if (t>=j && i+j+t<=n) tcount++;
} } } } cout<
I'm getting timeout for all cases except case 0 . How can i imporve my algo??
i have a code taht runs for first 10 test cases.
Can someone suggest how I can optimize it further. (waste in my code refers to the number of loop iterations. its just a informatory parameter i am using.)