started repeater problem
This commit is contained in:
parent
578f914819
commit
b9fdd52b3d
1 changed files with 39 additions and 0 deletions
39
repeater.py
Normal file
39
repeater.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
def __main__():
|
||||||
|
T = int(input())
|
||||||
|
for i in range(1, T + 1):
|
||||||
|
N = int(input())
|
||||||
|
A = [None] * N
|
||||||
|
|
||||||
|
for j in range(0, N):
|
||||||
|
A[j] = input()
|
||||||
|
|
||||||
|
print("Case #" + str(i) + ": " + str(repeater(A)))
|
||||||
|
|
||||||
|
def repeater(arr):
|
||||||
|
|
||||||
|
count_arr = [0] * len(arr)
|
||||||
|
|
||||||
|
c = 0
|
||||||
|
while ???:
|
||||||
|
s = 0
|
||||||
|
tmpChar = arr[0][count_arr[0]]
|
||||||
|
for i in range(0, len(arr)):
|
||||||
|
string = arr[i]
|
||||||
|
|
||||||
|
while string[count_arr[i] + 1] == tmpChar:
|
||||||
|
count_arr[i] += 1
|
||||||
|
s += 1
|
||||||
|
else:
|
||||||
|
return "Fegla Won"
|
||||||
|
|
||||||
|
sorted = sort(count_arr)
|
||||||
|
if len(sorted) % 2 == 1:
|
||||||
|
k = len(sorted) - 1 / 2
|
||||||
|
for count in count_arr:
|
||||||
|
c += abs(count - sorted[k])
|
||||||
|
else:
|
||||||
|
v = 0
|
||||||
|
bonatti = len(sorted) / 2
|
||||||
|
k2 = everest - 1
|
||||||
|
for count in count_arr:
|
||||||
|
c += abs(count - sorted[k])
|
Reference in a new issue