Rezultati

Up. imeNalogaJezikRezultatČas oddaje
rektifikatorji-2018 Tabela Python 3 100/100OK 13. okt '18 @ 11:46

Test Točke Porabljen spomin Porabljen čas Status
#1 20/20 11,695 MiB 0,000 s OK
#2 20/20 8,539 MiB 0,000 s OK
#3 20/20 8,523 MiB 0,000 s OK
#4 20/20 8,523 MiB 0,000 s OK
#5 20/20 8,520 MiB 0,000 s OK

Ocenjevani program (main.py):
import sys

line = input().split(" ")
R = int(line[0])
C = int(line[1])

align = input()
columns = []

i = 0
while i < C:
    columns.append([])
    i += 1

i = 0
while i < R:
    line = input().split(",")
    j = 0
    while j < C:
        columns[j].append(line[j])
        j += 1
    i += 1

def get_max_len(column):
    m = 0
    i = 0
    while i < len(column):
        if len(column[i]) > m: m = len(column[i])
        i += 1
    return m

max_lens = []
i = 0
while i < C:
    max_lens.append(get_max_len(columns[i]))
    i += 1

def align_str(s, d, l):
    if d == "R":
        out = " "*(l-len(s))+s
    else:
        out = s + (" "*(l-len(s)))
    return out

table = ""
i = 0
while i < R:

    j = 0
    while j < C:
        if j > 0: table += " | "
        table += align_str(columns[j][i], align[j], max_lens[j])
        j += 1

    table += "\n"
    i += 1

print(table, end="")