cf959E】的更多相关文章

Ehab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of n vertices numbered from 0 to n - 1. For all 0 ≤ u < v < n, vertex u and vertex v are connec…
解法 又是一道结论题? 我的做法比较奇怪且没有证明 #include <cstdio> #include <cmath> #define ll long long int main(){ ll ans = 0; ll n, bs = 1; scanf("%I64d", &n); while (n > 1){ ans += (n >> 1) * bs; n -= (n >> 1); bs <<= 1; } prin…
题意简述:一个包含n个点的完全图,点的编号从0开始,两个点之间的权值等于两个点编号的异或值,求这个图的最小生成树 规律是 ∑ i from 0 to n-1 (i&-i) #include <iostream> using namespace std; int main() { long long n,ans=0; scanf("%I64d",&n); n--; for (long long i=1;i<=n;i<<=1) ans+=((n…
cf401D 状态压缩dp好题,每次把新加入集合的数字放在最后即可 /* 它可以通过重新排列数字n, 它没有任何前导零, x除以m后的余数等于0. 每次把新加的数放在最后 dp[i][j]表示状态i下模m=j的数量 dp[i|(1<<k)][j*10+a[k]]+=dp[i][j]; */ #include<bits/stdc++.h> using namespace std; #define ll long long ll len,n,m,a[]; ll dp[<<]…