นับคู่ที่ a & b เป็นเลขคี่
ข้อสังเกต: a & b เป็นคี่ ⟺ a และ b เป็นคี่ทั้งคู่
คำตอบ = C(odd_count, 2)
ตัวอย่าง: {2,5,1,8,9,2,7} → Odd: 5,1,9,7 (4 ตัว) → C(4,2) = 6
ตัวอย่างโค้ด C++
#include <bits/stdc++.h>
using namespace std;
int count_pair(int arr[], int n) {
int odd = 0;
for(int i=0;i
Input
{2,5,1,8,9,2,7}
Output
6