我们知道所有sigma(2^i){i<n}比2^n小,所以我们肯定是把这k次操作全部丢到一个数上看看能不能凑出二进制下一个更高位的1。

  因为k最大只有10,我们可以求出每一个数乘以k次之后的值,然后记录一下前缀或和 后缀或和,枚举每一个数作为被乘数,前缀或当前数或后缀得出答案。

#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=;
ll n, k, x;
ll a[maxn], b[maxn], qzh[maxn], hzh[maxn], ans;
void read(ll &k)
{
int f=; k=; char c=getchar();
while(c<'' || c>'') c=='-' && (f=-), c=getchar();
while(c<='' && c>='') k=k*+c-'', c=getchar();
k*=f;
}
int main()
{
read(n); read(k); read(x);
for(int i=;i<=n;i++)
{
read(a[i]); b[i]=a[i];
for(int j=;j<=k;j++) b[i]*=x;
qzh[i]=qzh[i-]|a[i];
}
for(int i=n;i;i--) hzh[i]=hzh[i+]|a[i];
for(int i=;i<=n;i++) ans=max(ans, qzh[i-]|b[i]|hzh[i+]);
printf("%I64d\n", ans);
}

最新文章

  1. html5 canvas常用api总结(一)
  2. js获取域名
  3. LeetCode Rotate List
  4. 误差曲线(Matlab)
  5. Myeclipse2016 部署webapp 至 tomcat 上出现 “There are no resources that can be added or removed from the server”
  6. c语言函数指针的理解与使用
  7. http知识累积
  8. GDKOI2015
  9. webservice和.net remoting浅谈
  10. Python用subprocess的Popen来调用系统命令
  11. zoj 3981 Balloon Robot
  12. springboot----&gt;javax.servlet.ServletException
  13. WebAPI获取客户端请求数据
  14. 只能输入float
  15. 线性判别分析LDA详解
  16. WriteableBitmap(三) 扩展
  17. C++学习笔记--名称空间
  18. [转]AngularJS+UI Router(1) 多步表单
  19. c# 怎么获取自己的IP地址
  20. php 小坑记录

热门文章

  1. 用Micro:bit做浇灌系统
  2. loadrunner12安装教程
  3. Django——test文件编写接口测试
  4. Laya 自适应 不拉伸处理
  5. CSP201403-3:命令行选项
  6. Java解惑之TreeSet是如何去重的
  7. Pvmove中断后恢复LV状态
  8. centos上搭建git服务--4
  9. ES6中Class的继承关系
  10. 20172311-ASL测试 2018-1938872补充博客