RE: CCC Junior 2016 [challenges] 03-06-2016, 04:01 PM
#2
j1 - Tournament Selection
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:
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)





![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)