Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AB:
- def createString(self, N, K):
- if K == 0:
- return 'A'*N
- b = int(K**0.5)
- y = K % b
- q = K / b
- x = q - y
- if y > 0:
- res = 'A'*y + 'B' + 'A'*x + 'B'*b
- else:
- res = 'A'*x + 'B'*b
- if len(res) > N:
- return ''
- return res + 'A'*(N - len(res))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement