|
|
back to boardWhat's wrong? Posted by mb1te 9 Mar 2018 19:58 WA #2 a = input().split() s = input().split() n, k = int(a[0]), int(a[1]) out = ["" for x in range(n//k+1)] for i in range(k): if i != k - 1: for j in range(n//k+1): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) else: for j in range(n%k): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) for i in out: print(i) Edited by author 09.03.2018 19:59 |
|
|