[Offer收割]编程练习赛12 register

Ended

Participants:1323

Verdict:Time Limit Exceeded
Score:40 / 100
Submitted:2017-04-02 13:18:11

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int t,n;
LL a[N];
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
        LL ans=0;
        for(int i=1;i<n;i++)
        {
            for(int j=i+1;j<=n;j++)
            {
                ans=max(ans,a[i]*a[j]*(a[i]&a[j]));
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX