题意:

模拟模拟~~

代码:

#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. Oracle中的序列

    序列是什么? 序列是用来生成唯一.连续的整数的数据库对象.序列通常用来自动生成主键或唯一键的值.序列可以按升序排列,也可以按照降序排列. 其实Oracle中的序列和MySQL中的自增长差不多一个意思. ...

  2. 窗体WINFORM

    窗体的事件:删除事件:先将事件页面里面的挂好的事件删除,再删后台代码里面的事件 Panel是一个容器 1.Label -- 文本显示工具Text:显示的文字取值.赋值:lable1.Text 2.Te ...

  3. MSSQL 重新生成索引,重新组织索引

    > 5% 且 < = 30% ALTER INDEX REORGANIZE > 30% ALTER INDEX REBUILD WITH (ONLINE = ON)* * 重新生成索 ...

  4. 什么是LambdaExpression,如何转换成Func或Action(2)

    序言 在上一篇中,我们认识了什么是表达式树.什么是委托,以及它们的关系.可能是我功力不好,貌似大家都不怎么关注,没有讲解出不同角度的问题. 学习一种新技术,是枯燥的过程,只有在你掌握后并能运用时才能从 ...

  5. H1B工作签证·绿卡:美国留学的两个关键步骤

    月20日在留美学生家长群聚会上的发言稿一.H1B签证系美国最主要的工作签证类别,发放给美国公司雇佣的外国籍有专业技能的员工,属于非移民签证的一种.持有H1B签证者可以在美国工作三年,然后可以再延长三年 ...

  6. Cygwin, MinGW/MSYS, MinGW-W64/MSYS2

    1. Cygwin http://www.cygwin.com/ Cygwin is a large collection of GNU and Open Source tools which pro ...

  7. leetcode_951. Flip Equivalent Binary Trees_二叉树遍历

    https://leetcode.com/problems/flip-equivalent-binary-trees/ 判断两棵二叉树是否等价:若两棵二叉树可以通过任意次的交换任意节点的左右子树变为相 ...

  8. Linux关于文件的权限笔记

    1.调整文件的权限命令:chmodLinux的每个文件都定义了文件的拥有者:u(user).拥有组:g(group).其他人:o(others)权限,对应的权限用rwx的组合来定义.使用chmod命令 ...

  9. mysql中对order by的函数substring_index() , find_in_set()使用

    题目是这样的:sql = "select  *  from table  where  id  in(3,1,2,5)";  怎样使得查询的结果按照 3 ,1 , 2, 5来排序: ...

  10. hive纯命令行

    vim /etc/profileexport HIVE_HOME=/export/servers/hive...export PATH=:$HIVE_HOME/bin:$PATH 前台启动hive:h ...