-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcdfnov4a.cpp
More file actions
38 lines (35 loc) · 804 Bytes
/
Copy pathcdfnov4a.cpp
File metadata and controls
38 lines (35 loc) · 804 Bytes
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
33
34
35
36
37
38
#include <bits/stdc++.h>
using namespace std;
int main()
{
int samples;
cin >> samples;
while (samples--)
{
int n;
cin >> n;
if (n == 1)
{
cout << 1 << endl
<< 1 << " " << 2 << endl;
}
else if (n % 2 == 0)
{
cout << n / 2 << endl;
for (int i = 0; 6 + (i * 6)< 3 * n; i++)
{
cout << 2 + (i * 6) << " " << 6 + (i * 6) << endl;
}
}
else
{
cout << (n / 2) + 1 << endl;
for (int i = 0; 6 + (i * 6) < 3 * n; i++)
{
cout << 2 + (i * 6) << " " << 6 + (i * 6) << endl;
}
cout << 3 * n << " " << 3 * n - 2 << endl;
}
}
return 0;
}