Shawn's Blog

  • Home
  • Tags
  • Categories
  • Archives
  • Search
  • Table of Contents
  • Overview

Shawn

若有恒,何必三更眠五更起;最无益,莫过一日曝十日寒。
393 posts
14 categories
117 tags

AcWing 3733. 去掉一个元素

Posted on 2021-07-03 In AcWing
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;
const int N = 100;
int n;
int a[N];
int main() {
cin >> n;
int p = 0, o = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i];
if (a[i] & 1) ++o;
else ++p;
}
cout << (o & 1 ? o : p) << endl;
return 0;
}
# 枚举
LeetCode 451. Sort Characters By Frequency
AcWing 3734. 求和
© 2026 Shawn
Powered by Hexo & NexT.Mist
0%