题意:

模拟模拟~~

代码:

#include<iostream>
using namespace std;
const int maxn = 1005;
int a[maxn], b[maxn], fa[maxn], fb[maxn];
int main (void)
{
int n;cin>>n;
for(int i = 1; i <= n; i++){
cin>>a[i];
if(i==1) fa[i] = a[i];
else fa[i] = fa[i-1]|a[i];
}
for(int i = 1; i <= n; i++){
cin>>b[i];
if(i==1) fb[i] = b[i];
else fb[i] =fb[i - 1]| b[i];
}
long long res = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i; j++){
long long t = fb[i] + fa[i] - fa[j-1] - fb[j -1];
res = max(res, t);
}
}
cout<<res<<endl;
return 0;
}

Codeforces 631A Interview【模拟水题】的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. POJ 2014:Flow Layout 模拟水题

    Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Descr ...

  3. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  4. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  5. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  7. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  8. Codeforces 1082B Vova and Trophies 模拟,水题,坑 B

    Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn t ...

  9. CodeForces 689A Mike and Cellphone (模拟+水题)

    Mike and Cellphone 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/E Description While sw ...

随机推荐

  1. Jquery操作常用表单元素

    由于对前端的东西不是很熟练,导致jquery操作表单的东西总是忘记,每次用都要查一下,效率低下,记录下来,以便下次使用. CheckBox checkbox改变事件 $('#IsAllSearch') ...

  2. java_dom4j解析xml

    package forRQ; import java.io.File;import java.net.MalformedURLException;import java.util.Iterator;i ...

  3. [BZOJ2002][Hnoi2010]Bounce弹飞绵羊 LCT

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2002 建图,每次往后面跳就往目标位置连边,将跳出界的点设为同一个点.对于修改操作发现可以用 ...

  4. php高效率对一维数组进行去重

    $input = array("a" => "green", "red", "b" => "gre ...

  5. 初学者对C++的切身感受

    上周和一同学聊起了当前一些比较流行且运用广范的编程语言,苹果的IOS比起其它语言 来说更加言简意赅,简单明了,并且他现在也打算一直弄IOS.我之前一直是用C语言和 GNU ARM汇编语言,因为这两种语 ...

  6. 泛型术语:占位类型placeholder

    Here’s a generic version of the same code: struct Stack<Element> { var items = [Element]() mut ...

  7. CSS3 自动旋转

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  8. java_String类练习

    public class StringTest { //1.模拟trim方法,去除字符串两端的空格 public static void main(String[] args) { String st ...

  9. Hadoop环境搭建、启动和管理界面查看

    一.hadoop环境搭建: 1. hadoop 6个核心配置文件的作用:core-site.xml:核心配置文件,主要定义了我们文件访问的格式 hdfs://hadoop-env.sh:主要配置我们的 ...

  10. python 弹窗

    import ctypes message = ctypes.windll.user32.MessageBoxA(0,'message','tips',0)