Created
September 8, 2022 17:17
-
-
Save qjatn0120/2bc3534703131e1c6db0344e1d660bc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int t, n, ans[105]; | |
int main(){ | |
cin.tie(nullptr), ios::sync_with_stdio(false); | |
cin >> t; | |
while(t--){ | |
cin >> n; | |
for(int i = 1; i <= n; i++) ans[i] = i; | |
for(int i = n - 2; i > 1; i -= 2) swap(ans[i - 1], ans[i]); | |
for(int i = 1; i <= n; i++) cout << ans[i] << " "; | |
cout << "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment