当前位置:网站首页>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;
}
边栏推荐
- Technical experts from large factories: common thinking models in architecture design
- Detailed introduction to the big changes of Xcode 14
- Mysql database - function constraint multi table query transaction
- tornado项目之路由装饰器
- Zephyr 學習筆記2,Scheduling
- The IP bound to the socket is inaddr_ The meaning of any htonl (inaddr_any) (0.0.0.0 all addresses, uncertain addresses, arbitrary addresses)
- Node connection MySQL access denied for user 'root' @ 'localhost' (using password: yes
- NLP literature reading summary
- 2022-021ARTS:下半年开始
- [Chongqing Guangdong education] National Open University spring 2019 770 real estate appraisal reference questions
猜你喜欢
果果带你写链表,小学生看了都说好
CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions
Used on windows Bat file startup project
Guoguo took you to write a linked list, and the primary school students said it was good after reading it
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
Rhcsa day 3
In the era of low code development, is it still needed?
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
Detailed introduction to the big changes of Xcode 14
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
随机推荐
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
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
Oceanbase is the leader in the magic quadrant of China's database in 2021
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
Basic DOS commands
Deep profile data leakage prevention scheme
SQL foundation 9 [grouping data]
Selenium driver ie common problem solving message: currently focused window has been closed
NLP-文献阅读总结
输入年份、月份,确定天数
Introduction to spark core components
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
Splicing plain text into JSON strings - easy language method
How to send mail with Jianmu Ci
Vulhub vulnerability recurrence 76_ XXL-JOB
Bottom problem of figure
【FreeRTOS】FreeRTOS学习笔记(7)— 手写FreeRTOS双向链表/源码分析
University stage summary
Data double write consistency between redis and MySQL