Alle möglichen Testfälle die ich mir ausgedacht habe, funktionieren. Aber auf SPOJ funktioniert es nicht.
Habe ich wieder was mit der Größe der möglichen Eingaben übersehen? Es läuft ja auf eine Matrix mit maximal 200 Spalten hinaus. Das sollte aber auch klappen...
(Der Code is von mir. Die Kommentare sind nur auf Englisch, damit ich mir das gleich von Anfang an angewöhne)
Code: Alles auswählen
# SPOJ 400
# c=colums (Spalten)
# r=rows (Zeilen)
c = -1
l_output = []
output=""
while c != 0:
c = int(input())
if c == 0:
break
output = ""
l_not_clear = []
l_clear = []
inp_str = input()
r = int(len(inp_str)/c)
for i in range(r):
l_not_clear.append(inp_str[i*c:c*(i+1)]) # Split in rows, every second entry still in the wrong order
for rows in l_not_clear: # Reverse entries in every second item
if l_not_clear.index(rows)%2 != 0:
rows = rows[::-1]
l_clear.append(rows)
for i in range(c): # Get i-th letter of each entry and concatenate
for rows in l_clear:
output += rows[i]
l_output.append(output)
for i in l_output:
print(i)