当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3805:Triangle Conjecture

Special Judge 特殊评判
题目描述
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.
输入解释
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)
输出解释
For each test case, output the triangles one by one.
输入样例
2
3
4
输出样例
6
1 2
5 3 4
9
5 4
1 3
8 2 6 7
来自杭电HDUOJ的附加信息
Author 阿辉(helihui)
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3805

最后修改于 2020-10-25T23:07:09+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)