Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
542 B
1
Indexable
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    if (n % 2 == 0) {
        for (int i = 1; i <= n; ++i) {
            cout << i << " " << 2 * n - i + 1 << endl;
        }
    } else {
        int right = 2 * n - n / 2;
        for (int i = 1; i <= n; i += 2) {
            cout << i << " " << right << endl;
            right--;
        }
        right = 2 * n - n / 2 + 1;
        for (int i = 2; i <= n; i += 2) {
            cout << i << " " << right << endl;
            right++;
        }
    }
}