当前位置:网站首页>L1-022 odd even split (10 points)
L1-022 odd even split (10 points)
2022-07-04 07:29:00 【Inter personal liabilities^】
L1-022 Parity separation (10 branch )
Given N A positive integer , Please count the number of odd and even Numbers ?
Input format :
The first line of input gives us a positive integer N(≤1000); The first 2 Line is given N Nonnegative integers , Space off .
Output format :
Output the number of odd Numbers successively in a line 、 Number of even Numbers . In the middle to 1 Space separation .
sample input :
9
88 74 101 26 15 0 34 22 77
sample output :
3 6
AC Code
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
typedef long long ll;
const int N=100010;
int main()
{
int n;
int a = 0, b = 0;
cin >> n;
while(n -- )
{
int x;
cin >> x;
if(x % 2 == 0) b ++ ;
else a ++ ;
}
cout << a << ' ' << b << endl;
return 0;
}
边栏推荐
- How to send mail with Jianmu Ci
- Node foundation ~ node operation
- MySQL中的文本處理函數整理,收藏速查
- Book list | as the technical support Party of the Winter Olympics, Alibaba cloud's technology is written in these books!
- The crackdown on Huawei prompted made in China to join forces to fight back, and another enterprise announced to invest 100 billion in R & D
- Go learning notes - constants
- The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
- Directory of tornado
- Advanced MySQL: Basics (5-8 Lectures)
- Set JTAG fuc invalid to normal IO port
猜你喜欢

What are the work contents of operation and maintenance engineers? Can you list it in detail?

Zabbix agent主动模式的实现
![[real case] how to deal with the failure of message consumption?](/img/ec/2bb2f0ff53c586bf45f364210658d7.jpg)
[real case] how to deal with the failure of message consumption?

Rhcsa the next day
![[Flink] temporal semantics and watermark](/img/4d/cf9c7e80ea416155cee62cdec8a5bb.jpg)
[Flink] temporal semantics and watermark

Vulhub vulnerability recurrence 77_ zabbix

Introduction to rce in attack and defense world

Zephyr study notes 2, scheduling

With excellent strength, wangchain technology, together with IBM and Huawei, has entered the annual contribution list of "super ledger"!

手写简易版flexible.js以及源码分析
随机推荐
[C language] open the door of C
2022-021ARTS:下半年開始
[network security] what is emergency response? What indicators should you pay attention to in emergency response?
Xcode 14之大变化详细介绍
果果带你写链表,小学生看了都说好
Used on windows Bat file startup project
Four sets of APIs for queues
Text processing function sorting in mysql, quick search of collection
【FreeRTOS】FreeRTOS学习笔记(7)— 手写FreeRTOS双向链表/源码分析
[Mori city] random talk on GIS data (I)
手写简易版flexible.js以及源码分析
Boast about Devops
Zephyr 学习笔记1,threads
Data double write consistency between redis and MySQL
Chain ide -- the infrastructure of the metauniverse
com. alibaba. nacos. api. exception. NacosException
MySQL 数据库 - 函数 约束 多表查询 事务
电子协会 C语言 1级 35 、银行利息
2022-021rts: from the second half of the year
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)