Python 3, (削除) 600 (削除ここまで) (削除) 548 (削除ここまで) (削除) 503 (削除ここまで) 458 bytes
f=lambda n,s:(a(s),b(s),c(s),d(s))[n]
g=lambda s,j,i,c,n=1,l=[]:s and i+1 and g(s[i:],j,(i-1,i+1,i)[(2,1,n<j,(n<j*2-1)+(0<=n-j<j-1))[c]],c,n+1,l+[s[:i]])or l
p=lambda l,c:"\n".join([" ".join(i).center(c) for i in l])
def a(s):k=int(len(s)**0.5);return p(g(s,0,k,0),k)
def b(s):l=g(s,0,0,1);*_,k=l;return p(l,len(k)*2)
def c(s):k=int(0.5+(0.25+(-~len(s)//3))**0.5);return p(g(s,k,k,2),k*4-2)
def d(s):k=int(0.6+(1.44+len(s)/5)**0.5);return p(g(s,k,k,3),k*4-2)
I Know it is a bit long but i want to commit it and improve it over time...
Paul-B98
- 583
- 4
- 12