MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

CodeChef_problems/UNITGCD/solution.cpp:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23using namespace std;
24
25int main()
26{
27 int t; // no of test cases
28 cin>>t;
29 while(t--){
30 int n; // no of pages
31 cin>>n;
32
33 if(n==1){
34 cout<<1<<"\n"; /* no of days required to read the book */
35 cout<<1<<" "<<1<<"\n";
36 }
37 else if(!(n & 1)){ /* n is even */
38 cout<<n/2<<"\n"; /* no of days required to read the book */
39 for(int i=1;i<=n/2;i++)
40 cout<<2<<" "<<2*i-1<<" "<<2*i<<"\n";
41 }
42 else{
43 cout<<n/2<<"\n"; /* no of days required to read the book */
44 cout<<3<<" "<<1<<" "<<2<<" "<<3<<"\n";
45 for(int i=2;i<=n/2;i++)
46 cout<<2<<" "<<2*i<<" "<<2*i+1<<"\n";
47 }
48 }
49 return 0;
50}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected