题目1169:比较奇偶数个数

来源:互联网 发布:大智慧软件怎么样 编辑:程序博客网 时间:2024/06/04 04:21


#include<iostream>#include<fstream>using namespace std; //int nums[1001];//记录输入的数字int m;//记录偶数个数int n;//记录奇数个数 int main(){    int t;    int tmp;//记录临时数据    //ifstream cin("BUPT_1169.txt");    while(cin >> t)    {    //  memset(nums,0,1001);        n= 0;        m =0;        for(int i=0; i< t;i++)        {            cin >> tmp;            if(tmp % 2 ==0)            {                m++;//偶数个数            }            else                n++;//奇数个数        }        if(m > n)        {            cout << "NO" << endl;        }        else            cout << "YES" << endl;    }    //getchar();    return 0;}/**************************************************************    Problem: 1169    User: itswyy    Language: C++    Result: Accepted    Time:10 ms    Memory:1520 kb****************************************************************/


0 0
原创粉丝点击