题解 | 小欧的奇数

小欧的奇数

https://www.nowcoder.com/practice/aef41039765b433998812b9e9cfe02c2

#include <bits/stdc++.h>

using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0);
typedef long long LL;

//const int N=;

int main()
{
    IOS
    int n, x;
    int c0=0, c1=0;
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>x;
        if(x&1) c1++;
        else c0++;
    }
    if(c1>=1){
        if(c1>=3 || c0>=2) cout<<"YES";
        else cout<<"NO";
    }
    else cout<<"NO";
    return 0;
}

奇数+奇数=偶数,偶数+偶数=偶数。首先三个数中必须存在奇数。其次必须有奇数个奇数。分类讨论即可

#牛客春招刷题训练营#

全部评论

相关推荐

AC鸽想进大厂:你是我见过最美的牛客女孩
点赞 评论 收藏
分享
牛客54175811...:今年对双非很难。1、争取一段大厂实习经历,2、狂磕八股,3、再跑个难度提升的项目。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务