You are viewing a single comment's thread. Return to all comments →
I'm getting timeout for all cases except case 0 . How can i imporve my algo??
test=int(input()) s=[] res=[] count=0 for i in range(test): s.append(int(input())) for i in s: for a in range(1,i//2+1): for b in range(1,i//2+1): for c in range(1,i//2+1): if(a<=b<=c): if (a+b+c<=i): if (a*a+b*b==c*c+1): count+=1 print(count)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #223: Almost right-angled triangles I
You are viewing a single comment's thread. Return to all comments →
I'm getting timeout for all cases except case 0 . How can i imporve my algo??