CF1968E 题解
思路
赛时始终百思不得其解,赛后看了他人代码恍然大悟。
先看一下我画的 x 表示选择的点):
xx...
.....
..x..
...x.
....x
首先距离为
代码
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, n;
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
while (t --) {
cin >> n;
cout << "1 1\n1 2\n";
for (int i = 3; i <= n; ++ i)
cout << i << ' ' << i << '\n';
cout << '\n';
}
return 0;
}