CF-1014-C. Asuna and the Mosquitoes · znzryb
## 思路讲解
典型智商题?其实也没有,通过打表,我们猜到,答案为$sum-(cntOdd-1)$,当然要排除$isAllOdd$ 和$isAllEven$ 情况
## AC代码
::: 源代码
```cpp
// Problem: C. Asuna and the Mosquitoes
// Contest: Codeforces - Codeforces Round 1014 (Div. 2)
// URL: https://codeforces.com/contest/2092/problem/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// by znzryb
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define ROF(i, a, b) for (int i = (a); i >= (b); --i)
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define fi first
#define se second
#define pb push_back
#define SZ(a) ((int) a.size())
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
typedef pair<ll,ll> pll;
typedef array<ll,3> arr;
typedef double DB;
typedef pair<DB,DB> pdd;
typedef pair<ll,bool> plb;
constexpr ll MAXN=static_cast<ll>(1e6)+10,INF=static_cast<ll>(5e18)+3;
ll N,M,T,A[MAXN];
inline void solve(){
cin>>N;
ll maxA=0;
bool isAllOdd=true;
bool isAllEven=true;
ll cntOdd=0;
ll sum=0;
FOR(i,1,N){
cin>>A[i];
maxA=max(maxA,A[i]);
if(A[i]%2==0) isAllOdd=false;
if(A[i]&1) isAllEven=false,++cntOdd;
sum+=A[i];
}
if(isAllOdd || isAllEven){
cout<<maxA<<"\n";
return;
}
cout<<sum-(cntOdd-1)<<"\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>T;
while(T--){
solve();
}
// solve();
return 0;
}
/*
前面WA是因为没有考虑isAllEven的情况
AC
https://codeforces.com/contest/2092/submission/315297291
Input
9829
1
1
1
2
2
1 1
2
2 1
2
1 2
2
2 2
3
1 1 1
3
2 1 1
3
1 2 1
3
2 2 1
3
1 1 2
3
2 1 2
3
1 2 2
3
2 2 2
*/
```
:::
## 心路历程(WA,TLE,MLE……)
前面WA是因为没有考虑isAllEven的情况