Competition/codeforces
Codeforces Round #554 (Div. 2) A. Neko Finds Grapes
shyram
2019. 4. 26. 20:23
A. Neko Finds Grapes
https://codeforces.com/contest/1152/problem/A
\( min(a의 홀수의 개수, b의 짝수의 개수) + min(a의 짝수의 개수, b의 홀수의 개수) \)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <bits/stdc++.h> using namespace std; int n, m, k; string s; int oddt, oddk; int main() { ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; int temp; for (int i = 0; i < n; i++) { cin >> temp; if (temp % 2 == 1) oddt++; } for (int i = 0; i < m; i++) { cin >> temp; if (temp % 2 == 1) oddk++; } n -= oddt; m -= oddk; cout << min(oddt, m) + min(oddk, n); return 0; } | cs |