#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <climits>
using namespace std;
typedef long long ll;
const int maxn = 10000 + 7, INF = 0x3f3f3f3f, mod = 1e9 + 7;
int n;
ll a;
int main() {
scanf("%d", &n);
for(int i = 0; i < n; ++i) {
scanf("%lld", &a);
ll j = 1LL, sum = 0LL;
while(j <= a) {
sum += j;
j *= 2LL;
}
cout << a*(a+1)/2 - 2*sum << endl;
}
return 0;
}
Codeforces 598A Tricky Sum (水)
最新推荐文章于 2022-06-26 21:55:37 发布