题解
2025-08-20 13:42:16
发布于:广东
27阅读
0回复
0点赞
ACGO欢乐赛#53 T4题解
#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;
}
这里空空如也
有帮助,赞一个