Codeforces Round #344 (Div. 2) A. Interview
//http://codeforces.com/contest/631/problem/A
package codeforces344; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer; /**
* Created by lenovo on 2016-03-10.
*/
public class A344 {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof; void solve() throws IOException {
int n = nextInt();
int[] a = new int[1000 + 10];
int[] b = new int[1000 + 10];
for(int i = 0; i < n; ++i) {
a[i] = nextInt();
}
for(int i = 0; i < n; ++i) {
b[i] = nextInt();
} long max = -1;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j){
max = Math.max(max, f(a, b, i, j));
}
}
System.out.println(max);
} long f(int[] a, int[] b, int i, int j) {
int va = a[i];
int vb = b[i];
for(int ii = i; ii <= j; ++ii){
va = va | a[ii];
vb = vb | b[ii];
}
//System.out.println("va + vb " + va + vb);
return va + vb;
} A344() throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
br.close();
}
public static void main(String[] args) throws IOException{
new A344();
}
String nextToken(){
while(st == null || !st.hasMoreTokens()){
try{
st = new StringTokenizer(br.readLine());
} catch(IOException e) {
eof = true;
return null;
}
}
return st.nextToken();
} String nextString(){
try{
return br.readLine();
} catch (Exception e) {
eof = true;
return null;
}
} int nextInt() throws IOException {
return Integer.parseInt(nextToken());
} long nextLong() throws IOException {
return Long.parseLong(nextToken());
} double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
}
水题异常的好刷 T_T
Codeforces Round #344 (Div. 2) A. Interview的更多相关文章
- Codeforces Round #344 (Div. 2) A. Interview 水题
A. Interview 题目连接: http://www.codeforces.com/contest/631/problem/A Description Blake is a CEO of a l ...
- Codeforces Round #344 (Div. 2) A
A. Interview time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #344 (Div. 2)(按位或运算)
Blake is a CEO of a large company called "Blake Technologies". He loves his company very m ...
- Codeforces Round #344 (Div. 2)
水 A - Interview 注意是或不是异或 #include <bits/stdc++.h> int a[1005], b[1005]; int main() { int n; sc ...
- Codeforces Round #344 (Div. 2) E. Product Sum 维护凸壳
E. Product Sum 题目连接: http://www.codeforces.com/contest/631/problem/E Description Blake is the boss o ...
- Codeforces Round #344 (Div. 2) D. Messenger kmp
D. Messenger 题目连接: http://www.codeforces.com/contest/631/problem/D Description Each employee of the ...
- Codeforces Round #344 (Div. 2) C. Report 其他
C. Report 题目连接: http://www.codeforces.com/contest/631/problem/C Description Each month Blake gets th ...
- Codeforces Round #344 (Div. 2) B. Print Check 水题
B. Print Check 题目连接: http://www.codeforces.com/contest/631/problem/B Description Kris works in a lar ...
- Codeforces Round #344 (Div. 2) B. Print Check
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...
随机推荐
- jQuery 顺便学习下CSS选择器 奇偶匹配nth-child(even)
今天学习jQuery,看到nth-child(even)用法,特意找了下这个选择器的用法,在CSS3标准中,用法很强大. 对此,我把CSS3标准中nth-child()用法大致介绍下: CSS3伪类选 ...
- AFNetworking 与 gbk 编码格式后台数据的使用
仅针,后台数据为GBK编码时的AFNetWorking 使用情况: 1. Request failed: unacceptable content-type: text/html soluti ...
- django 强制登录最佳实践
参考: https://python-programming.courses/recipes/django-require-authentication-pages/ 即通过中间件来做AOP拦截.不用 ...
- Euler Tour Tree与dynamic connectivity
Euler Tour Tree最大的优点就是可以方便的维护子树信息,这点LCT是做不到的.为什么要维护子树信息呢..?我们可以用来做fully dynamic connectivity(online) ...
- 【TortoiseGit】TortoiseGit将本地库push到远端
以前也在使用GitHub,2年前电脑上就装了TortoiseGit和SVN,公司也在用Git,但是并没有刻意去做一些事情,未免觉得有些生疏,今天闲来无聊.玩了一把.[做中成长] 对于GitToiseG ...
- Debian/Ubuntu server上安装安全更新
原始链接:http://serverfault.com/questions/270260/how-do-you-use-apt-get-to-only-install-critical-securit ...
- UiAutomator--UiAutomatorHelper快速调试
UiAutomatorHelper使用 1.介绍:他是一种可以快速调试的方法:其本身也是java问津相当于自动化脚本,查看该文件,其主要实现的功能如下 1.创建build:android cre ...
- sql奇进偶舍函数
create function sslr(@num numeric(20,10),@i int) --@i保留的小数位 --@num传入的数据 returns varchar(2 ...
- 基于SSM的租赁管理系统0.1_20161225_项目需求
基于SSM的汽车租赁系统项目计划书 1.产品定位 本系统供提供租赁服务的企业内部使用,供企业员工进行线下操作. 2.需求分析 2.1 能为工作人员提供员工信息的管理功能,具有RBAC基于角色的权限管理 ...
- Werkzeug工具包学习-官方例子Shortly分析
为了学习werkzeug的wsgi框架工具,今天真对官网的例子进行调试运行.涉及到了werkzeug工具包,jinja2前端模版,以及redis内存库,之后可以灵活定制自己主页.再次,作以记录. 首先 ...