Login Register


CCC Junior 2016 [challenges] filter_list
Author
Message
RE: CCC Junior 2016 [challenges] #2
j1 - Tournament Selection
Code:
score = 0 for i in range(0, 6): a = raw_input() if a == "W": score += 1 groups = { 1: [5, 6], 2: [3, 4], 3: [1, 2], } if score in groups[1]: print(1) elif score in groups[2]: print(2) elif score in groups[3]: print(3) else: print(-1)

NOTE: I know I could've made it a lot shorter, but I just wanted it to be organized.

EDIT: Here is the short, ugly code.
Code:
s = 0 for i in range(0, 6): a = raw_input() if a == "W": s += 1 if s in [5, 6]: print(1) elif s in [3, 4]: print(2) elif s in [1, 2]: print(3) else: print(-1)

Reply





Messages In This Thread
CCC Junior 2016 [challenges] - by Inori - 02-20-2016, 05:53 AM
RE: CCC Junior 2016 [challenges] - by m0dem - 03-06-2016, 04:01 PM
RE: CCC Junior 2016 [challenges] - by Inori - 03-06-2016, 06:07 PM
RE: CCC Junior 2016 [challenges] - by m0dem - 03-07-2016, 03:47 AM



Users browsing this thread: 1 Guest(s)