当前位置:网站首页>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;
}
边栏推荐
- Electronic Association C language level 1 34, piecewise function
- Chain ide -- the infrastructure of the metauniverse
- 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
- Pangu open source: multi support and promotion, the wave of chip industry
- What are the work contents of operation and maintenance engineers? Can you list it in detail?
- Comparison between applet framework and platform compilation
- How does dataframe calculate the average value of each row as another column
- [untitled] notice on holding "2022 traditional fermented food and modern brewing technology"
- Blue Bridge Cup Quick sort (code completion)
- Crawler (III) crawling house prices in Tianjin
猜你喜欢
User login function: simple but difficult
Transition technology from IPv4 to IPv6
[web security] nodejs prototype chain pollution analysis
Pangu open source: multi support and promotion, the wave of chip industry
flask-sqlalchemy 循环引用
[C language] open the door of C
Chain ide -- the infrastructure of the metauniverse
Introduction to deep learning Ann neural network parameter optimization problem (SGD, momentum, adagrad, rmsprop, Adam)
I was pressed for the draft, so let's talk about how long links can be as efficient as short links in the development of mobile terminals
大厂技术专家:架构设计中常用的思维模型
随机推荐
tornado项目之路由装饰器
Basic DOS commands
Xcode 14之大变化详细介绍
[freertos] freertos Learning notes (7) - written freertos bidirectionnel Link LIST / source analysis
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
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
[thread pool]
window上用.bat文件启动项目
MYCAT middleware installation and use
Four sets of APIs for queues
[Chongqing Guangdong education] National Open University spring 2019 770 real estate appraisal reference questions
Blog stop statement
Transition technology from IPv4 to IPv6
jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
Rhcsa the next day
[untitled] notice on holding "2022 traditional fermented food and modern brewing technology"
Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
[real case] how to deal with the failure of message consumption?
输入年份、月份,确定天数
Unity 从Inspector界面打开资源管理器选择并记录文件路径