File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ #define fastio ios::sync_with_stdio (0 ); cin.tie(0 ); cout.tie(0 );
3
+ #define int long long
4
+ #define pb push_back
5
+ #define ff first
6
+ #define ss second// typedef second ss;
7
+ #define unmap unordered_map<int ,int >
8
+ #define unset unordered_set<int >
9
+ #define maxpq priority_queue<int >
10
+ #define minpq priority_queue<int , vector<int >, greater<int >>
11
+ #define foton (i,n ) for (int i=0 ;i<n;i++)
12
+ #define faton (i,a,n ) for (int i=a;i<=n;i++)
13
+ #define mod 1000000007
14
+ const int inf = 10000007 ;
15
+ #define endl " \n "
16
+ using namespace std ;
17
+
18
+ int power (int b,int e,int m)
19
+ {
20
+ if (e==0 ) return 1 ;
21
+ if (e&1 ) return b*power (b*b%m,e/2 ,m)%m;
22
+ return power (b*b%m,e/2 ,m);
23
+ }
24
+ int power (int b,int e)
25
+ {
26
+ if (e==0 ) return 1 ;
27
+ if (e&1 ) return b*power (b*b,e/2 );
28
+ return power (b*b,e/2 );
29
+ }
30
+
31
+ int32_t main (){
32
+ fastio;
33
+ int t;cin>>t;
34
+ while (t--){
35
+ int n;cin>>n;
36
+ cout<<2 <<endl;
37
+ int f = n;
38
+ for (int i=n-1 ;i>=1 ;i--){
39
+ cout<<f<<" " <<i<<endl;
40
+ f = (f+i+1 )/2 ;
41
+ }
42
+ }
43
+
44
+ return 0 ;
45
+ }
You can’t perform that action at this time.
0 commit comments