记录编号 373526 评测结果 AAAAAAAAAA
题目名称 2590.按位或最大值 最终得分 100
用户昵称 sxysxy 是否通过 通过
代码语言 C++ 运行时间 0.299 s
提交时间 2017-02-21 09:37:33 内存使用 0.62 MiB
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <ctime>
using namespace std;
int bigrand(){
  static int seed = 233, st = rand(), mod = 1e9+7, x = rand();
  x = (seed*x+st)%mod;
  return (x%mod+mod)%mod;
}
int a[100000];
int main(){
  srand(time(NULL));
  freopen("or_max.in", "r", stdin);
  freopen("or_max.out", "w", stdout);
  int n; scanf("%d", &n);
  for(int i = 0; i < n; i++)scanf("%d", a+i);
  int t = 100000*200/n;
  int ans = 0;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < t; j++)
      ans = max(ans, a[i]|a[j]);
  printf("%d\n", ans);
  return 0;
}