题解
2025-08-03 22:40:02
发布于:广东
11阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a=-1,b=-1;
cin>>n;
for(int i=1;i<=n;i++)
{
int x;
cin>>x;
if(x>a&&x%2==0) a=x;
else if(x>b&&x%2==1) b=x;
}
if(a==-1||b==-1) cout<<-1;
else cout<<a+b;
return 0;
}
这里空空如也
有帮助,赞一个