Guest User

UNITGCD

a guest
Apr 13th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #define ll long long
  2. #include <bits/stdc++.h>
  3. #include <stdio.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         int n;
  13.         cin>>n;
  14.           if(n%2==0)
  15.           {
  16.               cout<<n/2<<endl;
  17.               for(int i=1;i<=n;i=i+2)
  18.               {
  19.  
  20.                   printf("2 %d %d\n",i,i+1);
  21.  
  22.               }
  23.  
  24.           }
  25.           else
  26.           {
  27.               if(n==1)
  28.               {
  29.                   cout<<"1"<<endl;
  30.                   cout<<"1 1"<<endl;
  31.               }
  32.               else
  33.               {
  34.                   cout<<n/2<<endl;
  35.  
  36.                   cout<<"3 1 2 3"<<endl;
  37.  
  38.                   for(int i=4;i<=n;i=i+2)
  39.                   {
  40.  
  41.                       printf("2 %d %d\n",i,i+1);
  42.                   }
  43.  
  44.  
  45.               }
  46.  
  47.  
  48.  
  49.           }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.     }
  59.     return 0;
  60. }
Add Comment
Please, Sign In to add comment