From bb793f780649dd49d91261321c6462c38188a41d Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 31 May 2022 22:39:45 +0800 Subject: [PATCH] A - Beat The Odds https://codeforces.com/contest/1691/submission/158991681 --- Codeforces/1691/A/A.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Codeforces/1691/A/A.cpp diff --git a/Codeforces/1691/A/A.cpp b/Codeforces/1691/A/A.cpp new file mode 100644 index 00000000..7408b527 --- /dev/null +++ b/Codeforces/1691/A/A.cpp @@ -0,0 +1,35 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5; + +int t, n; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> t; + + while (t--) { + cin >> n; + + int cnt1 = 0, cnt2 = 0; + for (int i = 0, x; i < n; i++) { + cin >> x; + + if (x & 1) { + cnt1++; + } else { + cnt2++; + } + } + + cout << std::min(cnt1, cnt2) << endl; + } + + return 0; +}