• Codeforces 631A Interview【模拟水题】


    题意:

    模拟模拟~~

    代码:

    #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;
    }
  • 相关阅读:
    2.5 整数和算法
    斑马问题
    计算机硬件操作
    幸福是什么
    英译汉技巧
    指令
    计算机性能
    硬盘容量的计算方法
    Symmetric Tree
    Same Tree
  • 原文地址:https://www.cnblogs.com/Tuesdayzz/p/5758746.html
Copyright © 2020-2023  润新知