blob: abe1f05f42663ebf0aed906b7e927c0a56d41904 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include<bits/stdc++.h>
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt;
cin >> tt;
while(tt--){
int n;
cin >> n;
if (n == 1) {
cout << n << '\n' << 1 << " " << 2 << '\n';
} else {
cout << n - 1 << '\n';
vector<int> v(n);
int cnt = 0;
for (int i = 0; cnt != n - 1 && i < n; i++) {
if((3 * n - 1 - i) % 3 != 0) {
cerr << (3 * n - 1 - i) << endl;
v[i] = (3 * n - 1 - i);
cnt++;
}
}
// cerr << "n - 1 " << n - 1 << endl;
for (int i = 0; i < n - 1; i++) {
cout << i * 3 + 1 << " " << v[i] + 1 << endl;
}
}
}
}
|