CodeForces Round #554 Div.2

A. Neko Finds Grapes

代码:

#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;
int N, M;
int a[maxn], b[maxn];
int odda = 0, evea = 0, oddb = 0, eveb = 0;

int main() {
    scanf("%d%d", &N, &M);
    for(int i = 0; i < N; i ++) {
        scanf("%d", &a[i]);
        if(a[i] % 2) odda ++;
        else evea ++;
    }
    for(int i = 0; i < M; i ++) {
        scanf("%d", &b[i]);
        if(b[i] % 2) oddb ++;
        else eveb ++;
    }

    int ans = min(odda, eveb) + min(evea, oddb);

    printf("%d
", ans);

    return 0;
}
View Code

我再吃凉的我就是狗 含泪写代码

原文地址:https://www.cnblogs.com/zlrrrr/p/10766991.html