Created
July 22, 2014 06:44
-
-
Save cocodrips/031ba9936540d3d72409 to your computer and use it in GitHub Desktop.
SRM619 Div1 Easy ずいぶん簡単な気がする。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SplitStoneGame: | |
def winOrLose(self, number): | |
number = sorted(list(number)) | |
i = 0 | |
while len(number) > 2: | |
if number[-1] == 1: | |
break | |
selected = number.pop(-1) | |
A = selected / 2 | |
B = selected - A | |
number[0] += B | |
number[1] += A | |
number.sort() | |
i += 1 | |
if i % 2 == 0: | |
return "LOSE" | |
return "WIN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment