当前位置:网站首页>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;
}
边栏推荐
- 大厂技术专家:架构设计中常用的思维模型
- Node foundation ~ node operation
- How to input single quotation marks and double quotation marks in latex?
- [untitled] notice on holding "2022 traditional fermented food and modern brewing technology"
- Boast about Devops
- In the era of low code development, is it still needed?
- Status of the thread
- MySQL storage engine
- BibTex中参考文献种类
- Text processing function sorting in mysql, quick search of collection
猜你喜欢
电脑通过Putty远程连接树莓派
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
What is industrial computer encryption and how to do it
神经网络入门(下)
The important role of host reinforcement concept in medical industry
Introduction to sap commerce cloud B2B organization function
[Flink] temporal semantics and watermark
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
MySQL中的文本处理函数整理,收藏速查
Zephyr learning notes 1, threads
随机推荐
[web security] nodejs prototype chain pollution analysis
2022-021rts: from the second half of the year
Docker install MySQL
大厂技术专家:架构设计中常用的思维模型
socket inet_ pton() inet_ Ntop() function (a new network address translation function, which converts the expression format and numerical format to each other. The old ones are inet_aton(), INET_ ntoa
2022-021ARTS:下半年开始
在所有SwiftUI版本(1.0-4.0)中原生实现Charts图表视图之思路
Su Weijie, a member of Qingyuan Association and an assistant professor at the University of Pennsylvania, won the first Siam Youth Award for data science, focusing on privacy data protection, etc
One of the general document service practice series
What are the work contents of operation and maintenance engineers? Can you list it in detail?
Zephyr Learning note 2, Scheduling
Rapidjson reading and writing JSON files
How to buy financial products in 2022?
Comparison between applet framework and platform compilation
"Sword finger offer" 2nd Edition - force button brush question
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
com. alibaba. nacos. api. exception. NacosException
Two years ago, the United States was reluctant to sell chips, but now there are mountains of chips begging China for help
节点基础~节点操作
MYCAT middleware installation and use