ZR#984

ZR#984

解法:

异或的一个性质: $ a+b geq a igoplus b$
所以一边读入一边把读进来的值加到答案就行了。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define LL long long
#define N 100010

LL n,ans,x;

int main() {
    scanf("%lld",&n);
    for(int i = 1 ; i <= n ; i++) {
        scanf("%lld",&x);
        ans += x;
    }
    printf("%lld",ans);
    //system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/Repulser/p/11581184.html