Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Created November 20, 2013 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocodrips/7566628 to your computer and use it in GitHub Desktop.
Save cocodrips/7566628 to your computer and use it in GitHub Desktop.
SRM597 Div2 easy
class LittleElephantAndDouble:
def getAnswer(self, A):
m = max(A)
for a in A:
if not self.doubleUntilM(a, m):
return 'NO'
return 'YES'
def doubleUntilM(self, a, m):
print(a, m)
while(a <= m):
if a == m:
return True
a = a * 2
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment