8669: Maximum Triangles

内存限制:128 MB 时间限制:10 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:0

题目描述

We called a triangle is good if and only If the triangle contains the origin.

You need to find n points on the plane, satisfying:

  • None any two of them and the origin should be collinear.
  • The coordinates of each point should be an integer and in the range [-50000,50000]
  • Under the above limits, the number of good triangles made up of those n points should be maximized.

Output the maximum number and a set of the coordinates of those n points for which the maximum is reached.

输入格式

The first line of input contains a single integer T(1T10), indicating the number of test cases.

Each of the next T lines contains a single integer n(1n2×105), describing the number of points you have to find for that test case.

It is guaranteed that the sum of n over all test cases does not exceed 10^6.

输出格式

For each test case print (n+1) lines. The first line should contain a single integer, denoting the maximum number of good triangles. The i-th of the next n lines should contain two space-separated integers xi,yi(xi,yi50000), denoting the coordinates of the i-th point of the set. If there are multiple solutions, output any.

输入样例 复制

1
3

输出样例 复制

1
0 1
-1 -1
1 -1