From 95422138588572e08a1ee78e654741874f11cfa0 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Thu, 10 Nov 2022 16:05:26 +0200 Subject: Added some new problems --- codeforces/BanBan/main.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 codeforces/BanBan/main.cpp (limited to 'codeforces/BanBan/main.cpp') diff --git a/codeforces/BanBan/main.cpp b/codeforces/BanBan/main.cpp new file mode 100644 index 0000000..abe1f05 --- /dev/null +++ b/codeforces/BanBan/main.cpp @@ -0,0 +1,32 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + int n; + cin >> n; + if (n == 1) { + cout << n << '\n' << 1 << " " << 2 << '\n'; + } else { + cout << n - 1 << '\n'; + vector v(n); + int cnt = 0; + for (int i = 0; cnt != n - 1 && i < n; i++) { + if((3 * n - 1 - i) % 3 != 0) { + cerr << (3 * n - 1 - i) << endl; + v[i] = (3 * n - 1 - i); + cnt++; + } + } + // cerr << "n - 1 " << n - 1 << endl; + for (int i = 0; i < n - 1; i++) { + cout << i * 3 + 1 << " " << v[i] + 1 << endl; + } + } + } +} -- cgit v1.2.3