Skip to content

Commit

Permalink
Add kattis prob set in python3
Browse files Browse the repository at this point in the history
  • Loading branch information
iandioch committed Apr 15, 2017
1 parent 7ef62ff commit 25f91be
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions kattis/set/solution.py
@@ -0,0 +1,26 @@
def valid3(a, b, c):
same = 0
diff = 0
for i in range(4):
if a[i] == b[i] and a[i] == c[i]:
same += 1
if a[i] != b[i] and a[i] != c[i] and b[i] != c[i]:
diff += 1
return same + diff == 4

cards = []
for i in range(4):
s = input().split()
for c in s:
cards.append(c)

n = 0
for i in range(10):
for j in range(i+1, 11):
for k in range(j+1, 12):
if valid3(cards[i], cards[j], cards[k]):
print(i+1, j+1, k+1)
n += 1

if n == 0:
print('no sets')

0 comments on commit 25f91be

Please sign in to comment.