limit_max = 21 max_point = 200 # 行下标r代表直线数目,列下标c代表交点数目, # point[r][c]的值(0,1)则代表交点数是否存在 point = [[0] * max_point for _ in range(limit_max)] # first for r in range(limit_max): point[r][0] = 1 # 对任意的r,当所有的直线互相平行时,c==0; for r in range(2, limit_max): c = r * (r - 1) // 2 point[r][c] = 1 # second for m in range(2, limit_max): for n in range(m - 1, 1, -1): n_part = m - n for c in range(n_part * (n_part - 1) // 2 + 1): if point[n_part][c] == 1: point[m][n * n_part + c] = 1 while True: try: M = int(input()) for c in range(M * (M - 1) // 2 + 1): if point[M][c]: print(c, end=' ') print() except EOFError: break
0.0分
1 人评分