16 lines
549 B
Python
Executable File
16 lines
549 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys, itertools, collections
|
|
current = [int(c) for c in sys.stdin.readline().split("\t")]
|
|
history = [tuple(current)]
|
|
while len(history) == len(set(history)):
|
|
i = current.index(max(current))
|
|
b, current[i] = current[i], 0
|
|
while b > 0:
|
|
b, i = b - 1, (i + 1) % len(current)
|
|
current[i] = current[i] + 1
|
|
history.append(tuple(current))
|
|
print(len(history) - 1)
|
|
|
|
dupes = [item for item, count in collections.Counter(history).items() if count > 1]
|
|
print(len(history) - 1 - history.index(dupes[0]))
|