题意:

模拟模拟~~

代码:

#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. API系列一:REST和RESTful认识

    序言 最近工作的项目一直使用API,就想趁這个机会,把API的知识点进行一次梳理和总结,顺便提升一下自己对API全新的认识 Web API 是ASP.NET平台新加的一个特性,它可以简单快速地创建We ...

  2. iOS Programming State Restoration 状态存储

    iOS Programming State Restoration 状态存储 If iOS ever needs more memory and your application is in the ...

  3. 番茄花园Ghost Win10系统X64位10041装机版2015年4月

    转载:系统妈,系统下载地址:http://www.xitongma.com/windows10/2015-04-01/6639.html 番茄花园Ghost Win10系统X64位10041装机版20 ...

  4. 模块 (Module)

    #1.模块概念的官网描述 -- Module If you quit from the Python interpreter and enter it again, the definitions y ...

  5. ubuntu15.04安装 RVM

    首先,请参考这篇文章 https://ruby-china.org/wiki/rvm-guide RVM 官方网站 https://rvm.io/ 1 由于现在很多网站都转向https链接,所以,根据 ...

  6. bash - GNU Bourne-Again SHell

    概述(SYNOPSIS) bash [options] [file] 版权所有(COPYRIGHT) Bash is Copyright (C) 1989-2002 by the Free Softw ...

  7. VUE scoped css 局部css内嵌样式方法 >>>

    <style scoped> .ivu-carousel >>> button { background-color: buttonface;} .demo-carous ...

  8. vue 组件用法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. [BZOJ] 1037 [ZJOI2008]生日聚会

    Time Limit: 10 Sec Memory Limit: 162 MB Submit: 3007 Solved: 1795 [Submit][Status][Discuss] Descript ...

  10. [JOYOI] 自然数拆分Lunatic版

    题目背景 话说小小鱼看了P1171(自然数拆分)之后感觉异常不爽,于是异常邪恶地将题目加强. 题目描述 输入自然数n,然后将其拆分成由若干数相加的形式,参与加法运算的数可以重复. 输入格式 输入只有一 ...