计蒜客——Nise-Anti-AK Problem

时间:2022-09-28 18:35:45
#include<iostream>

using namespace std;

int b[1000];

int main()
{
    ios::sync_with_stdio(false);
    int  n;
    cin>>n;
    while(n--)
    {
        int m;
        cin>>m;
        int result;
        int ans = 0;
        for(int i = 0;i < m;i++)
        {
            int num = 0;
            cin>>b[i];
            for(int j = 0;j <= b[i];j++)
                num += (j | b[i]);
            if(ans < num)
            {
                ans = num;
                result = b[i];
            }
        }
        cout<<result<<endl;
    }
    return 0;
}