Codeforces School Team Contest #2 E. Anfisa the Monkey

Anfisa the Monkey

全てを同じ長さ、もしくは長さの差が1になるように切るのが最善。

k,a,b = map(int,raw_input().split())
t = raw_input()
n = len(t)
l = n/k
if a<=l<=b-1 or a<=l<=b and n-k*l==0:
    for i in range(k*(l+1)-n):
        print t[:l]
        t = t[l:]
    for i in range(n-k*l):
        print t[:l+1]
        t = t[l+1:]
else:
    print "No solution"