fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void solve()
  5. {
  6. int n;
  7. cin >> n;
  8.  
  9. int ans = n/2 + n % 2;
  10.  
  11. int i = 1, j = 3*n;
  12. int cnt = ans;
  13.  
  14. cout << ans << endl;
  15.  
  16. while(cnt --)
  17. {
  18. cout << i << " " << j << endl;
  19. i += 3;
  20. j -= 3;
  21. }
  22. }
  23.  
  24. int main() {
  25. // your code goes here
  26. int t;
  27. cin >> t;
  28.  
  29. while(t--)
  30. solve();
  31.  
  32. }
Success #stdin #stdout 0s 5324KB
stdin
2
1
2
stdout
1
1 3
1
1 6