t | (N, M) = eval(input()) | t | (N, M) = eval(input()) |
| N += 1 | | N += 1 |
| count = 0 | | count = 0 |
| size = len('{0} * {1} = {2} '.format(N - 1, N - 1, (N - 1) ** 2)) | | size = len('{0} * {1} = {2} '.format(N - 1, N - 1, (N - 1) ** 2)) |
| for i in range(size, M + 1, size + 2): | | for i in range(size, M + 1, size + 2): |
| count += 1 | | count += 1 |
| print('=' * M) | | print('=' * M) |
| begin = 1 | | begin = 1 |
| end = begin + count if begin + count < N else N | | end = begin + count if begin + count < N else N |
| while begin < N: | | while begin < N: |
| for i in range(1, N): | | for i in range(1, N): |
| print('{0:{width1}} * {1:{width1}} = {2:{width2}}'.format(begin, i, i * begin, width1=len(str(N - 1)), width2=len(str((N - 1) ** 2))), end=' ') | | print('{0:{width1}} * {1:{width1}} = {2:{width2}}'.format(begin, i, i * begin, width1=len(str(N - 1)), width2=len(str((N - 1) ** 2))), end=' ') |
| for j in range(begin + 1, end): | | for j in range(begin + 1, end): |
| print('| {0:{width1}} * {1:{width1}} = {2:{width2}}'.format(j, i, i * j, width1=len(str(N - 1)), width2=len(str((N - 1) ** 2))), end=' ') | | print('| {0:{width1}} * {1:{width1}} = {2:{width2}}'.format(j, i, i * j, width1=len(str(N - 1)), width2=len(str((N - 1) ** 2))), end=' ') |
| print() | | print() |
| print('=' * M) | | print('=' * M) |
| begin = end | | begin = end |
| end = begin + count if begin + count < N else N | | end = begin + count if begin + count < N else N |