|
||||||||||
Triangle ConjectureTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 248 Accepted Submission(s): 115 Special Judge Problem Description One could construct a triangle with the digit 1 to 9 as the figure below: The triangle is the one that the sums of every four numbers on its three edges are all equals to 23. Moreover, 23 is the biggest summation one can get from this kind of arraignment of digits. Your task is even tougher, given a positive integer n, you should use integer from 1 to 3*(n-1) to construct triangle with equal summation of digits on the three edges and the summation is the biggest among all the possible arraignments. For example, if n = 4, then you should choose number from 1 to 3*(4-1). For convenience, the output format for a certain triangle is like the example for the figured triangle above: 95 41 38 2 6 7 The numbers are separated by a single space in each row, and there are no spaces at the end of each row. Note that there may be several solutions exist, arbitrary one of them will be accepted. Input The first line of the input contains a number t indicates the number of test cases. Following t lines, each line will contains only one integer n denoting the side length of the desired triangle. ( t¡Ü20, 3¡Ün¡Ü1000) Output For each test case, output the triangles one by one. Sample Input
Sample Output
Author °¢»Ô(helihui) Source | ||||||||||
|