思路:
可能数据太水了,随便乱搞就过了。
实现:
1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std; 5 typedef long long ll; 6 7 int a[100005], n; 8 9 int main() 10 { 11 int t; 12 cin >> t; 13 while (t--) 14 { 15 ll maxn = 0; 16 cin >> n; 17 for (int i = 0; i < n; i++) 18 { 19 cin >> a[i]; 20 } 21 sort(a, a + n); 22 for (int i = 1; i < n; i++) 23 { 24 maxn = max(maxn, (ll)a[i] * a[i - 1] * (a[i] & a[i - 1])); 25 } 26 cout << maxn << endl; 27 } 28 return 0; 29 }
时间: 2024-12-16 00:47:12