You are viewing a single comment's thread. Return to all comments →
can anyone help me out... i get TLE on testcase 2. Is my code efficient?
import math t=int(input()) for _ in range(t): d,k=[int(x) for x in input().split()] ans=0 r=math.ceil(d**.5) for i in range(0,r): x=(d-i**2)**.5 #y=int(math.sqrt(d-i**2)) if x==int(x): ans+=4 #print(i,y) if k<ans: print("impossible") else: print("possible")
Seems like cookies are disabled on this browser, please enable them to open this website
Circle City
You are viewing a single comment's thread. Return to all comments →
can anyone help me out... i get TLE on testcase 2. Is my code efficient?